n = int(input())
lst = []
for i in range(n):
  s, p = input().split()
  p = int(p)
  lst.append((s, p, i+1))
lst_sorted = sorted(lst, key=lambda x: (x[0], -x[1], x[2]))
for _, _, num in lst_sorted:
  print(num) n = int(input()) n int(input()) int input() input lst = [] lst [] for i in range(n):
  s, p = input().split()
  p = int(p)
  lst.append((s, p, i+1)) i range(n) range n s, p = input().split() s input().split() ().split () input split p p = int(p) p int(p) int p lst.append((s, p, i+1)) lst.append lst append (s, p, i+1) s p i+1 i 1 lst_sorted = sorted(lst, key=lambda x: (x[0], -x[1], x[2])) lst_sorted sorted(lst, key=lambda x: (x[0], -x[1], x[2])) sorted lst key=lambda x: (x[0], -x[1], x[2]) key lambda x: (x[0], -x[1], x[2]) (x[0], -x[1], x[2]) x[0] x 0 -x[1] x[1] x 1 x[2] x 2 x for _, _, num in lst_sorted:
  print(num) _ _ num lst_sorted print(num) print num s, p = input().split() input().split() s n = int(input()) int(input()) n p = int(p) int(p) p lst = [] [] lst p = input().split() input().split() p lst_sorted = sorted(lst, key=lambda x: (x[0], -x[1], x[2])) sorted(lst, key=lambda x: (x[0], -x[1], x[2])) lst_sorted
n = int(input())
lst = []
for i in range(n):
  s, p = input().split()
  p = int(p)
  lst.append((s, p, i+1))
lst_sorted = sorted(lst, key=lambda x: (x[0], -x[1], x[2]))
for _, _, num in lst_sorted:
  print(num)
