N = int(input())
my_list = []
for i in range(1,N+1):
    l = list((input().split()))
    l.append(i)
    my_list.append(l)
 
my_list2 = sorted(my_list, key=lambda x:(x[0],-int(x[1])))
for i in my_list2:
  print(i[2])
  N = int(input()) N int(input()) int input() input my_list = [] my_list [] for i in range(1,N+1):
    l = list((input().split()))
    l.append(i)
    my_list.append(l)
  i range(1,N+1) range 1 N+1 N 1 l = list((input().split())) l list((input().split())) list input().split() ().split () input split l.append(i) l.append l append i my_list.append(l) my_list.append my_list append l my_list2 = sorted(my_list, key=lambda x:(x[0],-int(x[1]))) my_list2 sorted(my_list, key=lambda x:(x[0],-int(x[1]))) sorted my_list 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 i in my_list2:
  print(i[2])
  i my_list2 print(i[2]) print i[2] i 2 N = int(input()) int(input()) N my_list = [] [] my_list my_list2 = sorted(my_list, key=lambda x:(x[0],-int(x[1]))) sorted(my_list, key=lambda x:(x[0],-int(x[1]))) my_list2 l = list((input().split())) list((input().split())) l
N = int(input())
my_list = []
for i in range(1,N+1):
    l = list((input().split()))
    l.append(i)
    my_list.append(l)
 
my_list2 = sorted(my_list, key=lambda x:(x[0],-int(x[1])))
for i in my_list2:
  print(i[2])
 