n = int(input())
sp = []
for i in range(n):
  s_, p_,  = input().split()
  sp.append([s_, int(p_)])

sp1 = sp
sp2 = sorted(sp, key=lambda x:(x[0], -x[1]))

for i in range(n):
  print(sp1.index(sp2[i])+1) n = int(input()) n int(input()) int input() input sp = [] sp [] for i in range(n):
  s_, p_,  = input().split()
  sp.append([s_, int(p_)]) i range(n) range n s_, p_,  = input().split() s_ input().split() ().split () input split p_ sp.append([s_, int(p_)]) sp.append sp append [s_, int(p_)] s_ int(p_) int p_ sp1 = sp sp1 sp sp2 = sorted(sp, key=lambda x:(x[0], -x[1])) sp2 sorted(sp, key=lambda x:(x[0], -x[1])) sorted sp key=lambda x:(x[0], -x[1]) key lambda x:(x[0], -x[1]) (x[0], -x[1]) x[0] x 0 -x[1] x[1] x 1 x for i in range(n):
  print(sp1.index(sp2[i])+1) i range(n) range n print(sp1.index(sp2[i])+1) print sp1.index(sp2[i])+1 sp1.index(sp2[i]) sp1.index sp1 index sp2[i] sp2 i 1 sp1 = sp sp sp1 sp = [] [] sp s_, p_,  = input().split() input().split() s_ sp2 = sorted(sp, key=lambda x:(x[0], -x[1])) sorted(sp, key=lambda x:(x[0], -x[1])) sp2 p_,  = input().split() input().split() p_ n = int(input()) int(input()) n
n = int(input())
sp = []
for i in range(n):
  s_, p_,  = input().split()
  sp.append([s_, int(p_)])

sp1 = sp
sp2 = sorted(sp, key=lambda x:(x[0], -x[1]))

for i in range(n):
  print(sp1.index(sp2[i])+1)