n=int(input())

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

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

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

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

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

for i in range(n):
  print(sp[i][2])