N = int(input())
L = []
for i in range(N):
  s, p = map(str, input().split())
  L.append([s, -int(p), i+1])
L = sorted(L)

for i in range(N):
  print(L[i][2]) N = int(input()) N int(input()) int input() input L = [] L [] for i in range(N):
  s, p = map(str, input().split())
  L.append([s, -int(p), i+1]) i range(N) range N s, p = map(str, input().split()) s map(str, input().split()) map str input().split() ().split () input split p L.append([s, -int(p), i+1]) L.append L append [s, -int(p), i+1] s -int(p) int(p) int p i+1 i 1 L = sorted(L) L sorted(L) sorted L for i in range(N):
  print(L[i][2]) i range(N) range N print(L[i][2]) print L[i][2] [i] L i 2 s, p = map(str, input().split()) map(str, input().split()) s L = sorted(L) sorted(L) L N = int(input()) int(input()) N L = [] [] L p = map(str, input().split()) map(str, input().split()) p
N = int(input())
L = []
for i in range(N):
  s, p = map(str, input().split())
  L.append([s, -int(p), i+1])
L = sorted(L)

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