n=int(input())
d=sorted(list(list(input().split())+[i+1] for i in range(n)),key=lambda x:(x[0],-int(x[1])))
for v in d:print(v[2]) n=int(input()) n int(input()) int input() input d=sorted(list(list(input().split())+[i+1] for i in range(n)),key=lambda x:(x[0],-int(x[1]))) d sorted(list(list(input().split())+[i+1] for i in range(n)),key=lambda x:(x[0],-int(x[1]))) sorted list(list(input().split())+[i+1] for i in range(n)) list list(input().split())+[i+1] list(input().split()) list input().split() ().split () input split [i+1] i+1 i 1 key=lambda x:(x[0],-int(x[1])) key lambda x:(x[0],-int(x[1])) (x[0],-int(x[1])) x[0] x 0 -int(x[1]) int(x[1]) int x[1] x 1 x for v in d:print(v[2]) v d d=sorted(list(list(input().split())+[i+1] for i in range(n)),key=lambda x:(x[0],-int(x[1]))) sorted(list(list(input().split())+[i+1] for i in range(n)),key=lambda x:(x[0],-int(x[1]))) d n=int(input()) int(input()) n
n=int(input())
d=sorted(list(list(input().split())+[i+1] for i in range(n)),key=lambda x:(x[0],-int(x[1])))
for v in d:print(v[2])