N = int(input())
guidebook = []
for i in range(N):
    S, P = input().split()
    P = int(P)
    guidebook.append([S,P])

new_guidebook = sorted(guidebook, key=lambda x: (x[0],-x[1]))

for i in new_guidebook:
    print(guidebook.index(i)+1) N = int(input()) N int(input()) int input() input guidebook = [] guidebook [] for i in range(N):
    S, P = input().split()
    P = int(P)
    guidebook.append([S,P]) i range(N) range N S, P = input().split() S input().split() ().split () input split P P = int(P) P int(P) int P guidebook.append([S,P]) guidebook.append guidebook append [S,P] S P new_guidebook = sorted(guidebook, key=lambda x: (x[0],-x[1])) new_guidebook sorted(guidebook, key=lambda x: (x[0],-x[1])) sorted guidebook key=lambda x: (x[0],-x[1]) key lambda x: (x[0],-x[1]) (x[0],-x[1]) x[0] x 0 -x[1] x[1] x 1 x for i in new_guidebook:
    print(guidebook.index(i)+1) i new_guidebook print(guidebook.index(i)+1) print guidebook.index(i)+1 guidebook.index(i) guidebook.index guidebook index i 1 S, P = input().split() input().split() S P = int(P) int(P) P new_guidebook = sorted(guidebook, key=lambda x: (x[0],-x[1])) sorted(guidebook, key=lambda x: (x[0],-x[1])) new_guidebook N = int(input()) int(input()) N P = input().split() input().split() P guidebook = [] [] guidebook
N = int(input())
guidebook = []
for i in range(N):
    S, P = input().split()
    P = int(P)
    guidebook.append([S,P])

new_guidebook = sorted(guidebook, key=lambda x: (x[0],-x[1]))

for i in new_guidebook:
    print(guidebook.index(i)+1)
