n=int(input())
sp=[]
for i in range(n):
	s,p=input().split()
	sp.append([s,int(p),i+1])

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

for ans in sort_sp:
	print(ans[2]) 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+1]) i range(n) range n s,p=input().split() s input().split() ().split () input split p sp.append([s,int(p),i+1]) sp.append sp append [s,int(p),i+1] s int(p) int p i+1 i 1 sort_sp=sorted(sp,key=lambda x:(x[0],-x[1])) sort_sp 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 ans in sort_sp:
	print(ans[2]) ans sort_sp print(ans[2]) print ans[2] ans 2 sort_sp=sorted(sp,key=lambda x:(x[0],-x[1])) sorted(sp,key=lambda x:(x[0],-x[1])) sort_sp n=int(input()) int(input()) n s,p=input().split() input().split() s p=input().split() input().split() p sp=[] [] sp
n=int(input())
sp=[]
for i in range(n):
	s,p=input().split()
	sp.append([s,int(p),i+1])

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

for ans in sort_sp:
	print(ans[2])