n=int(input())
res=[]
for i in range(n):
    s,p=map(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:(x[0], -x[1]))
for i in range(n):
	print(res1.index(res[i])+1) n=int(input()) n int(input()) int input() input res=[] res [] for i in range(n):
    s,p=map(str,input().split())
    res.append([s,int(p)]) i range(n) range n s,p=map(str,input().split()) s map(str,input().split()) map str input().split() ().split () input split p res.append([s,int(p)]) res.append res append [s,int(p)] s int(p) int p res1=res res1 res res=sorted(res,key=lambda x:(x[0], -x[1])) res sorted(res,key=lambda x:(x[0], -x[1])) sorted res 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(res1.index(res[i])+1) i range(n) range n print(res1.index(res[i])+1) print res1.index(res[i])+1 res1.index(res[i]) res1.index res1 index res[i] res i 1 p=map(str,input().split()) map(str,input().split()) p s,p=map(str,input().split()) map(str,input().split()) s n=int(input()) int(input()) n res1=res res res1 res=[] [] res res=sorted(res,key=lambda x:(x[0], -x[1])) sorted(res,key=lambda x:(x[0], -x[1])) res
n=int(input())
res=[]
for i in range(n):
    s,p=map(str,input().split())
    res.append([s,int(p)])
res1=res
res=sorted(res,key=lambda x:(x[0], -x[1]))
for i in range(n):
	print(res1.index(res[i])+1)