n=int(input())
rest=[]
for i in range(n):
  s,a=map(str,input().split())
  rest.append([s,-int(a),i+1])
rest=sorted(rest, key=lambda student: (student[0],student[1]))
for i in range(n):
  print(rest[i][2]) n=int(input()) n int(input()) int input() input rest=[] rest [] for i in range(n):
  s,a=map(str,input().split())
  rest.append([s,-int(a),i+1]) i range(n) range n s,a=map(str,input().split()) s map(str,input().split()) map str input().split() ().split () input split a rest.append([s,-int(a),i+1]) rest.append rest append [s,-int(a),i+1] s -int(a) int(a) int a i+1 i 1 rest=sorted(rest, key=lambda student: (student[0],student[1])) rest sorted(rest, key=lambda student: (student[0],student[1])) sorted rest key=lambda student: (student[0],student[1]) key lambda student: (student[0],student[1]) (student[0],student[1]) student[0] student 0 student[1] student 1 student for i in range(n):
  print(rest[i][2]) i range(n) range n print(rest[i][2]) print rest[i][2] [i] rest i 2 s,a=map(str,input().split()) map(str,input().split()) s rest=[] [] rest rest=sorted(rest, key=lambda student: (student[0],student[1])) sorted(rest, key=lambda student: (student[0],student[1])) rest n=int(input()) int(input()) n a=map(str,input().split()) map(str,input().split()) a
n=int(input())
rest=[]
for i in range(n):
  s,a=map(str,input().split())
  rest.append([s,-int(a),i+1])
rest=sorted(rest, key=lambda student: (student[0],student[1]))
for i in range(n):
  print(rest[i][2])