n=int(input())
lst=[]
for i in range(n):
  a,b=input().split()
  lst.append([a,b,i+1])
lst.sort(key=lambda x:(x[0],-int(x[1])))
for i in lst:
  print(i[2]) n=int(input()) n int(input()) int input() input lst=[] lst [] for i in range(n):
  a,b=input().split()
  lst.append([a,b,i+1]) i range(n) range n a,b=input().split() a input().split() ().split () input split b lst.append([a,b,i+1]) lst.append lst append [a,b,i+1] a b i+1 i 1 lst.sort(key=lambda x:(x[0],-int(x[1]))) lst.sort lst sort key=lambda x:(x[0],-int(x[1])) key lambda x:(x[0],-int(x[1])) (x[0],-int(x[1])) x[0] x 0 -int(x[1]) int(x[1]) int x[1] x 1 x for i in lst:
  print(i[2]) i lst print(i[2]) print i[2] i 2 a,b=input().split() input().split() a b=input().split() input().split() b lst=[] [] lst n=int(input()) int(input()) n
n=int(input())
lst=[]
for i in range(n):
  a,b=input().split()
  lst.append([a,b,i+1])
lst.sort(key=lambda x:(x[0],-int(x[1])))
for i in lst:
  print(i[2])