N = int(input())
l = []
for i in range(N):
  s, p = input().split()
  l.append([s, int(p), i+1])

# 地名に関して辞書順に / 点数に関して降順に並べる
l = sorted(l, key=lambda x:(x[0], -x[1]))
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 = input().split()
  l.append([s, int(p), i+1])

# 地名に関して辞書順に / 点数に関して降順に並べる i range(N) range N s, p = input().split() s 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 i+1 i 1 l = sorted(l, key=lambda x:(x[0], -x[1])) l sorted(l, key=lambda x:(x[0], -x[1])) sorted l 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 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 = input().split() input().split() s l = [] [] l N = int(input()) int(input()) N p = input().split() input().split() p l = sorted(l, key=lambda x:(x[0], -x[1])) sorted(l, key=lambda x:(x[0], -x[1])) l
N = int(input())
l = []
for i in range(N):
  s, p = input().split()
  l.append([s, int(p), i+1])

# 地名に関して辞書順に / 点数に関して降順に並べる
l = sorted(l, key=lambda x:(x[0], -x[1]))
for i in range(N):
  print(l[i][2])