N = int(input())

m = [0]*N

for i in range(N):
    k, v = input().split()
    m[i] = [k, int(v), i+1]

m.sort()

for j in range(N):
    for i in range(N-1):
        if m[i][0] == m[i+1][0] and m[i][1] < m[i+1][1]:
            m[i], m[i+1] = m[i+1], m[i]


for i in m:
    print(i[2]) N = int(input()) N int(input()) int input() input m = [0]*N m [0]*N [0] 0 N for i in range(N):
    k, v = input().split()
    m[i] = [k, int(v), i+1] i range(N) range N k, v = input().split() k input().split() ().split () input split v m[i] = [k, int(v), i+1] m[i] m i [k, int(v), i+1] k int(v) int v i+1 i 1 m.sort() m.sort m sort for j in range(N):
    for i in range(N-1):
        if m[i][0] == m[i+1][0] and m[i][1] < m[i+1][1]:
            m[i], m[i+1] = m[i+1], m[i] j range(N) range N for i in range(N-1):
        if m[i][0] == m[i+1][0] and m[i][1] < m[i+1][1]:
            m[i], m[i+1] = m[i+1], m[i] i range(N-1) range N-1 N 1 if m[i][0] == m[i+1][0] and m[i][1] < m[i+1][1]:
            m[i], m[i+1] = m[i+1], m[i] m[i][0] == m[i+1][0] and m[i][1] < m[i+1][1] m[i][0] == m[i+1][0] m[i][0] [i] m i 0 m[i+1][0] [i+1] m i+1 i 1 0 m[i][1] < m[i+1][1] m[i][1] [i] m i 1 m[i+1][1] [i+1] m i+1 i 1 1 m[i], m[i+1] = m[i+1], m[i] m[i] m i m[i+1] m i+1 i 1 m[i+1] m i+1 i 1 m[i] m i for i in m:
    print(i[2]) i m print(i[2]) print i[2] i 2 m = [0]*N [0]*N m k, v = input().split() input().split() k N = int(input()) int(input()) N v = input().split() input().split() v
N = int(input())

m = [0]*N

for i in range(N):
    k, v = input().split()
    m[i] = [k, int(v), i+1]

m.sort()

for j in range(N):
    for i in range(N-1):
        if m[i][0] == m[i+1][0] and m[i][1] < m[i+1][1]:
            m[i], m[i+1] = m[i+1], m[i]


for i in m:
    print(i[2])
