n=int(input())
dic={}
count={}

for i in range(n):
  s,p=map(str,input().split()) 
  p=int(p)
  dic[p]=s
  count[p]=i+1
  
a=sorted(dic.items(),reverse=True)
a=sorted(a,key=lambda x:x[1])

for p,s in a:
  for q,i in count.items():
    if p==q:
      print(i) n=int(input()) n int(input()) int input() input dic={} dic {} count={} count {} for i in range(n):
  s,p=map(str,input().split()) 
  p=int(p)
  dic[p]=s
  count[p]=i+1
   i range(n) range n s,p=map(str,input().split()) s map(str,input().split()) map str input().split() ().split () input split p p=int(p) p int(p) int p dic[p]=s dic[p] dic p s count[p]=i+1 count[p] count p i+1 i 1 a=sorted(dic.items(),reverse=True) a sorted(dic.items(),reverse=True) sorted dic.items() dic.items dic items reverse=True reverse True a=sorted(a,key=lambda x:x[1]) a sorted(a,key=lambda x:x[1]) sorted a key=lambda x:x[1] key lambda x:x[1] x[1] x 1 x for p,s in a:
  for q,i in count.items():
    if p==q:
      print(i) p s a for q,i in count.items():
    if p==q:
      print(i) q i count.items() count.items count items if p==q:
      print(i) p==q p q print(i) print i p=int(p) int(p) p a=sorted(dic.items(),reverse=True) sorted(dic.items(),reverse=True) a count={} {} count s,p=map(str,input().split()) map(str,input().split()) s a=sorted(a,key=lambda x:x[1]) sorted(a,key=lambda x:x[1]) a n=int(input()) int(input()) n p=map(str,input().split()) map(str,input().split()) p dic={} {} dic
n=int(input())
dic={}
count={}

for i in range(n):
  s,p=map(str,input().split()) 
  p=int(p)
  dic[p]=s
  count[p]=i+1
  
a=sorted(dic.items(),reverse=True)
a=sorted(a,key=lambda x:x[1])

for p,s in a:
  for q,i in count.items():
    if p==q:
      print(i)