list = []
N = int(input())
for i in range(N):
  S, P = map(str, input().split())
  list.append((i+1, S, int(P)))
list = sorted(list, key=lambda x:(x[1], -x[2]))
 
for l in list:
  print(l[0]) list = [] list [] N = int(input()) N int(input()) int input() input for i in range(N):
  S, P = map(str, input().split())
  list.append((i+1, S, int(P))) i range(N) range N S, P = map(str, input().split()) S map(str, input().split()) map str input().split() ().split () input split P list.append((i+1, S, int(P))) list.append list append (i+1, S, int(P)) i+1 i 1 S int(P) int P list = sorted(list, key=lambda x:(x[1], -x[2])) list sorted(list, key=lambda x:(x[1], -x[2])) sorted list key=lambda x:(x[1], -x[2]) key lambda x:(x[1], -x[2]) (x[1], -x[2]) x[1] x 1 -x[2] x[2] x 2 x for l in list:
  print(l[0]) l list print(l[0]) print l[0] l 0 list = sorted(list, key=lambda x:(x[1], -x[2])) sorted(list, key=lambda x:(x[1], -x[2])) list list = [] [] list N = int(input()) int(input()) N S, P = map(str, input().split()) map(str, input().split()) S P = map(str, input().split()) map(str, input().split()) P
list = []
N = int(input())
for i in range(N):
  S, P = map(str, input().split())
  list.append((i+1, S, int(P)))
list = sorted(list, key=lambda x:(x[1], -x[2]))
 
for l in list:
  print(l[0])