N = int(input())
book = []
for i in range(1, N+1):
  city, point = input().split()
  point = int(point)
  book.append(((city, -point), i))
book.sort()

for info in book:
  print(info[1]) N = int(input()) N int(input()) int input() input book = [] book [] for i in range(1, N+1):
  city, point = input().split()
  point = int(point)
  book.append(((city, -point), i)) i range(1, N+1) range 1 N+1 N 1 city, point = input().split() city input().split() ().split () input split point point = int(point) point int(point) int point book.append(((city, -point), i)) book.append book append ((city, -point), i) (city, -point) city -point point i book.sort() book.sort book sort for info in book:
  print(info[1]) info book print(info[1]) print info[1] info 1 city, point = input().split() input().split() city point = input().split() input().split() point N = int(input()) int(input()) N book = [] [] book point = int(point) int(point) point
N = int(input())
book = []
for i in range(1, N+1):
  city, point = input().split()
  point = int(point)
  book.append(((city, -point), i))
book.sort()

for info in book:
  print(info[1])