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

for n in range(N):
  s,p = input().split()
  R.append((s,-int(p),n+1))
  
for s,p,n in sorted(R):
  print(n) N = int(input()) N int(input()) int input() input R = [] R [] for n in range(N):
  s,p = input().split()
  R.append((s,-int(p),n+1))
   n range(N) range N s,p = input().split() s input().split() ().split () input split p R.append((s,-int(p),n+1)) R.append R append (s,-int(p),n+1) s -int(p) int(p) int p n+1 n 1 for s,p,n in sorted(R):
  print(n) s p n sorted(R) sorted R print(n) print n N = int(input()) int(input()) N p = input().split() input().split() p s,p = input().split() input().split() s R = [] [] R
N = int(input())
R = []

for n in range(N):
  s,p = input().split()
  R.append((s,-int(p),n+1))
  
for s,p,n in sorted(R):
  print(n)
