n=int(input())
alist = []
for i in range(n):
    a,b=input().split()
    alist.append([a, int(b)])
blist=sorted(alist,key=lambda x:x[1],reverse=True)
blist.sort(key=lambda x:x[0])
for i in range(n):
  print(alist.index(blist[i])+1) n=int(input()) n int(input()) int input() input alist = [] alist [] for i in range(n):
    a,b=input().split()
    alist.append([a, int(b)]) i range(n) range n a,b=input().split() a input().split() ().split () input split b alist.append([a, int(b)]) alist.append alist append [a, int(b)] a int(b) int b blist=sorted(alist,key=lambda x:x[1],reverse=True) blist sorted(alist,key=lambda x:x[1],reverse=True) sorted alist key=lambda x:x[1] key lambda x:x[1] x[1] x 1 x reverse=True reverse True blist.sort(key=lambda x:x[0]) blist.sort blist sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x for i in range(n):
  print(alist.index(blist[i])+1) i range(n) range n print(alist.index(blist[i])+1) print alist.index(blist[i])+1 alist.index(blist[i]) alist.index alist index blist[i] blist i 1 b=input().split() input().split() b n=int(input()) int(input()) n alist = [] [] alist a,b=input().split() input().split() a blist=sorted(alist,key=lambda x:x[1],reverse=True) sorted(alist,key=lambda x:x[1],reverse=True) blist
n=int(input())
alist = []
for i in range(n):
    a,b=input().split()
    alist.append([a, int(b)])
blist=sorted(alist,key=lambda x:x[1],reverse=True)
blist.sort(key=lambda x:x[0])
for i in range(n):
  print(alist.index(blist[i])+1)