N = int(input())
r_list = []
for i in range(N):
  item = input().split()
  item[1] = int(item[1])
  item.insert(0, i + 1)
  r_list.append(item)

r_list.sort(key = lambda x: x[2], reverse = True)
r_list.sort(key = lambda x: x[1])
for item in r_list:
  print(item[0]) N = int(input()) N int(input()) int input() input r_list = [] r_list [] for i in range(N):
  item = input().split()
  item[1] = int(item[1])
  item.insert(0, i + 1)
  r_list.append(item) i range(N) range N item = input().split() item input().split() ().split () input split item[1] = int(item[1]) item[1] item 1 int(item[1]) int item[1] item 1 item.insert(0, i + 1) item.insert item insert 0 i + 1 i 1 r_list.append(item) r_list.append r_list append item r_list.sort(key = lambda x: x[2], reverse = True) r_list.sort r_list sort key = lambda x: x[2] key lambda x: x[2] x[2] x 2 x reverse = True reverse True r_list.sort(key = lambda x: x[1]) r_list.sort r_list sort key = lambda x: x[1] key lambda x: x[1] x[1] x 1 x for item in r_list:
  print(item[0]) item r_list print(item[0]) print item[0] item 0 N = int(input()) int(input()) N item = input().split() input().split() item r_list = [] [] r_list
N = int(input())
r_list = []
for i in range(N):
  item = input().split()
  item[1] = int(item[1])
  item.insert(0, i + 1)
  r_list.append(item)

r_list.sort(key = lambda x: x[2], reverse = True)
r_list.sort(key = lambda x: x[1])
for item in r_list:
  print(item[0])