N = int(input())
SP = [list(input().split()) + [i + 1] for i in range(N)]

for i in range(N):
  SP[i][1] = -int(SP[i][1])

SP.sort()

for i in range(N):
  print(SP[i][2]) N = int(input()) N int(input()) int input() input list(input().split()) + [i + 1] for i in range(N) for i in range(N) i range(N) range N for i in range(N) list(input().split()) + [i + 1] list(input().split()) list input().split() ().split () input split [i + 1] i + 1 i 1 SP = [list(input().split()) + [i + 1] for i in range(N)] SP [list(input().split()) + [i + 1] for i in range(N)] for i in range(N):
  SP[i][1] = -int(SP[i][1]) i range(N) range N SP[i][1] = -int(SP[i][1]) SP[i][1] [i] SP i 1 -int(SP[i][1]) int(SP[i][1]) int SP[i][1] [i] SP i 1 SP.sort() SP.sort SP sort for i in range(N):
  print(SP[i][2]) i range(N) range N print(SP[i][2]) print SP[i][2] [i] SP i 2 N = int(input()) int(input()) N SP = [list(input().split()) + [i + 1] for i in range(N)] [list(input().split()) + [i + 1] for i in range(N)] SP
N = int(input())
SP = [list(input().split()) + [i + 1] for i in range(N)]

for i in range(N):
  SP[i][1] = -int(SP[i][1])

SP.sort()

for i in range(N):
  print(SP[i][2])