import numpy as np
N = int(input())
List = [[]]*N
for T in range(0,N):
    Str,Num = input().split()
    List[T] = [Str,int(Num),T+1]
SorL = sorted(List, key=lambda x:(x[0],-x[1]))
SorI = list(str(x[2]) for x in SorL)
print('\n'.join(SorI)) import numpy as np numpy N = int(input()) N int(input()) int input() input List = [[]]*N List [[]]*N [[]] [] N for T in range(0,N):
    Str,Num = input().split()
    List[T] = [Str,int(Num),T+1] T range(0,N) range 0 N Str,Num = input().split() Str input().split() ().split () input split Num List[T] = [Str,int(Num),T+1] List[T] List T [Str,int(Num),T+1] Str int(Num) int Num T+1 T 1 SorL = sorted(List, key=lambda x:(x[0],-x[1])) SorL sorted(List, key=lambda x:(x[0],-x[1])) sorted List 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 SorI = list(str(x[2]) for x in SorL) SorI list(str(x[2]) for x in SorL) list str(x[2]) str x[2] x 2 print('\n'.join(SorI)) print '\n'.join(SorI) '\n'.join '\n' join SorI N = int(input()) int(input()) N Num = input().split() input().split() Num List = [[]]*N [[]]*N List SorI = list(str(x[2]) for x in SorL) list(str(x[2]) for x in SorL) SorI Str,Num = input().split() input().split() Str SorL = sorted(List, key=lambda x:(x[0],-x[1])) sorted(List, key=lambda x:(x[0],-x[1])) SorL
import numpy as np
N = int(input())
List = [[]]*N
for T in range(0,N):
    Str,Num = input().split()
    List[T] = [Str,int(Num),T+1]
SorL = sorted(List, key=lambda x:(x[0],-x[1]))
SorI = list(str(x[2]) for x in SorL)
print('\n'.join(SorI))