n=int(input())

l=[]
for i in range(n):
  a,b=map(str, input().split())
  b=100-int(b)
  if b<10:
    b=str('0')+str(b)
  elif b==100:
    b="999"
  else:
    b=str(b)
  a=a+b
  l.append(a)

l2=sorted(l)

for i in range(n):
  print(l.index(l2[i])+1) n=int(input()) n int(input()) int input() input l=[] l [] for i in range(n):
  a,b=map(str, input().split())
  b=100-int(b)
  if b<10:
    b=str('0')+str(b)
  elif b==100:
    b="999"
  else:
    b=str(b)
  a=a+b
  l.append(a) i range(n) range n a,b=map(str, input().split()) a map(str, input().split()) map str input().split() ().split () input split b b=100-int(b) b 100-int(b) 100 int(b) int b if b<10:
    b=str('0')+str(b)
  elif b==100:
    b="999"
  else:
    b=str(b)
   b<10 b 10 b=str('0')+str(b) b str('0')+str(b) str('0') str '0' str(b) str b elif b==100:
    b="999"
   b==100 b 100 b="999" b "999" b=str(b) b str(b) str b a=a+b a a+b a b l.append(a) l.append l append a l2=sorted(l) l2 sorted(l) sorted l for i in range(n):
  print(l.index(l2[i])+1) i range(n) range n print(l.index(l2[i])+1) print l.index(l2[i])+1 l.index(l2[i]) l.index l index l2[i] l2 i 1 n=int(input()) int(input()) n a,b=map(str, input().split()) map(str, input().split()) a b="999" "999" b b=str(b) str(b) b b=map(str, input().split()) map(str, input().split()) b b=100-int(b) 100-int(b) b b=str('0')+str(b) str('0')+str(b) b l=[] [] l l2=sorted(l) sorted(l) l2 a=a+b a+b a
n=int(input())

l=[]
for i in range(n):
  a,b=map(str, input().split())
  b=100-int(b)
  if b<10:
    b=str('0')+str(b)
  elif b==100:
    b="999"
  else:
    b=str(b)
  a=a+b
  l.append(a)

l2=sorted(l)

for i in range(n):
  print(l.index(l2[i])+1)