N = int(input())
A = []
for i in range(N):
    S, P = map(str, input().split())
    P = int(P)
    A.append([S, -P])
S = sorted(A)
for j in S:
    print(A.index(j) + 1) N = int(input()) N int(input()) int input() input A = [] A [] for i in range(N):
    S, P = map(str, input().split())
    P = int(P)
    A.append([S, -P]) i range(N) range N S, P = map(str, input().split()) S map(str, input().split()) map str input().split() ().split () input split P P = int(P) P int(P) int P A.append([S, -P]) A.append A append [S, -P] S -P P S = sorted(A) S sorted(A) sorted A for j in S:
    print(A.index(j) + 1) j S print(A.index(j) + 1) print A.index(j) + 1 A.index(j) A.index A index j 1 P = map(str, input().split()) map(str, input().split()) P N = int(input()) int(input()) N S, P = map(str, input().split()) map(str, input().split()) S A = [] [] A S = sorted(A) sorted(A) S P = int(P) int(P) P
N = int(input())
A = []
for i in range(N):
    S, P = map(str, input().split())
    P = int(P)
    A.append([S, -P])
S = sorted(A)
for j in S:
    print(A.index(j) + 1)