n = int(input())
d = list(list(input().split())+[i+1] for i in range(n))
a = sorted(d, key=lambda x:(x[0],-int(x[1])))
for v in a:
  print(v[2]) n = int(input()) n int(input()) int input() input d = list(list(input().split())+[i+1] for i in range(n)) d 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 a = sorted(d, key=lambda x:(x[0],-int(x[1]))) a sorted(d, key=lambda x:(x[0],-int(x[1]))) sorted d 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 a:
  print(v[2]) v a print(v[2]) print v[2] v 2 a = sorted(d, key=lambda x:(x[0],-int(x[1]))) sorted(d, key=lambda x:(x[0],-int(x[1]))) a d = list(list(input().split())+[i+1] for i in range(n)) list(list(input().split())+[i+1] for i in range(n)) d n = int(input()) int(input()) n
n = int(input())
d = list(list(input().split())+[i+1] for i in range(n))
a = sorted(d, key=lambda x:(x[0],-int(x[1])))
for v in a:
  print(v[2])