N=int(input())
X=[]

for i in range(1,N+1):
    S,P=input().split()
    X.append((S,-int(P),i))

X.sort()
for (_,_,c) in X:
    print(c) N=int(input()) N int(input()) int input() input X=[] X [] for i in range(1,N+1):
    S,P=input().split()
    X.append((S,-int(P),i)) i range(1,N+1) range 1 N+1 N 1 S,P=input().split() S input().split() ().split () input split P X.append((S,-int(P),i)) X.append X append (S,-int(P),i) S -int(P) int(P) int P i X.sort() X.sort X sort for (_,_,c) in X:
    print(c) (_,_,c) _ _ c X print(c) print c P=input().split() input().split() P N=int(input()) int(input()) N X=[] [] X S,P=input().split() input().split() S
N=int(input())
X=[]

for i in range(1,N+1):
    S,P=input().split()
    X.append((S,-int(P),i))

X.sort()
for (_,_,c) in X:
    print(c)
