n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i+1])
res_s = sorted(res, key = lambda x: (x[0], -x[1]))
for i in range(n):
  print(res_s[i][2]) n = int(input()) n int(input()) int input() input res = [] res [] for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i+1]) i range(n) range n city, value = input().split() city input().split() ().split () input split value value = int(value) value int(value) int value res.append([city, value, i+1]) res.append res append [city, value, i+1] city value i+1 i 1 res_s = sorted(res, key = lambda x: (x[0], -x[1])) res_s sorted(res, key = lambda x: (x[0], -x[1])) sorted res 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(res_s[i][2]) i range(n) range n print(res_s[i][2]) print res_s[i][2] [i] res_s i 2 city, value = input().split() input().split() city res_s = sorted(res, key = lambda x: (x[0], -x[1])) sorted(res, key = lambda x: (x[0], -x[1])) res_s n = int(input()) int(input()) n value = int(value) int(value) value res = [] [] res value = input().split() input().split() value
n = int(input())

res = []
for i in range(n):
  city, value = input().split()
  value = int(value)
  res.append([city, value, i+1])
res_s = sorted(res, key = lambda x: (x[0], -x[1]))
for i in range(n):
  print(res_s[i][2])
