from operator import itemgetter
n=int(input())
SP=[list(map(str,input().split())) for i in range(n)]
for sp in SP:
  sp[1] = -1*int(sp[1])
SPsort = sorted(SP,key=itemgetter(0,1))
for i in range(n):
  print(SP.index(SPsort[i])+1) from operator import itemgetter n=int(input()) n int(input()) int input() input list(map(str,input().split())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split SP=[list(map(str,input().split())) for i in range(n)] SP [list(map(str,input().split())) for i in range(n)] for sp in SP:
  sp[1] = -1*int(sp[1]) sp SP sp[1] = -1*int(sp[1]) sp[1] sp 1 -1*int(sp[1]) -1 int(sp[1]) int sp[1] sp 1 SPsort = sorted(SP,key=itemgetter(0,1)) SPsort sorted(SP,key=itemgetter(0,1)) sorted SP key=itemgetter(0,1) key itemgetter(0,1) itemgetter 0 1 for i in range(n):
  print(SP.index(SPsort[i])+1) i range(n) range n print(SP.index(SPsort[i])+1) print SP.index(SPsort[i])+1 SP.index(SPsort[i]) SP.index SP index SPsort[i] SPsort i 1 SPsort = sorted(SP,key=itemgetter(0,1)) sorted(SP,key=itemgetter(0,1)) SPsort n=int(input()) int(input()) n SP=[list(map(str,input().split())) for i in range(n)] [list(map(str,input().split())) for i in range(n)] SP
from operator import itemgetter
n=int(input())
SP=[list(map(str,input().split())) for i in range(n)]
for sp in SP:
  sp[1] = -1*int(sp[1])
SPsort = sorted(SP,key=itemgetter(0,1))
for i in range(n):
  print(SP.index(SPsort[i])+1)