N = int(input())
ls = []
for i in range(N):
  s = input().split()
  ls.append([s[0],-int(s[1]),i+1])
ls.sort()
for i in range(N):
  print(ls[i][2]) N = int(input()) N int(input()) int input() input ls = [] ls [] for i in range(N):
  s = input().split()
  ls.append([s[0],-int(s[1]),i+1]) i range(N) range N s = input().split() s input().split() ().split () input split ls.append([s[0],-int(s[1]),i+1]) ls.append ls append [s[0],-int(s[1]),i+1] s[0] s 0 -int(s[1]) int(s[1]) int s[1] s 1 i+1 i 1 ls.sort() ls.sort ls sort for i in range(N):
  print(ls[i][2]) i range(N) range N print(ls[i][2]) print ls[i][2] [i] ls i 2 ls = [] [] ls N = int(input()) int(input()) N s = input().split() input().split() s
N = int(input())
ls = []
for i in range(N):
  s = input().split()
  ls.append([s[0],-int(s[1]),i+1])
ls.sort()
for i in range(N):
  print(ls[i][2])