N = int(input())
city = []
score = dict()
arr = []
for i in range(N):
  c, s = input().split()
  arr.append([c, int(s)])
  city.append(c)
  if c in score:
    score[c].append(int(s))
  else:
    score[c] = [int(s)]
city.sort()
ans = []
for i, var in enumerate(city):
  t = score[var].index(max(score[var]))
  u = score[var].pop(t)
  ans.append(arr.index([var,u]) + 1)
for i in ans:
  print(i) N = int(input()) N int(input()) int input() input city = [] city [] score = dict() score dict() dict arr = [] arr [] for i in range(N):
  c, s = input().split()
  arr.append([c, int(s)])
  city.append(c)
  if c in score:
    score[c].append(int(s))
  else:
    score[c] = [int(s)] i range(N) range N c, s = input().split() c input().split() ().split () input split s arr.append([c, int(s)]) arr.append arr append [c, int(s)] c int(s) int s city.append(c) city.append city append c if c in score:
    score[c].append(int(s))
  else:
    score[c] = [int(s)] c in score c score score[c].append(int(s)) [c].append [c] score c append int(s) int s score[c] = [int(s)] score[c] score c [int(s)] int(s) int s city.sort() city.sort city sort ans = [] ans [] for i, var in enumerate(city):
  t = score[var].index(max(score[var]))
  u = score[var].pop(t)
  ans.append(arr.index([var,u]) + 1) i var enumerate(city) enumerate city t = score[var].index(max(score[var])) t score[var].index(max(score[var])) [var].index [var] score var index max(score[var]) max score[var] score var u = score[var].pop(t) u score[var].pop(t) [var].pop [var] score var pop t ans.append(arr.index([var,u]) + 1) ans.append ans append arr.index([var,u]) + 1 arr.index([var,u]) arr.index arr index [var,u] var u 1 for i in ans:
  print(i) i ans print(i) print i N = int(input()) int(input()) N arr = [] [] arr ans = [] [] ans score = dict() dict() score city = [] [] city c, s = input().split() input().split() c t = score[var].index(max(score[var])) score[var].index(max(score[var])) t s = input().split() input().split() s u = score[var].pop(t) score[var].pop(t) u
N = int(input())
city = []
score = dict()
arr = []
for i in range(N):
  c, s = input().split()
  arr.append([c, int(s)])
  city.append(c)
  if c in score:
    score[c].append(int(s))
  else:
    score[c] = [int(s)]
city.sort()
ans = []
for i, var in enumerate(city):
  t = score[var].index(max(score[var]))
  u = score[var].pop(t)
  ans.append(arr.index([var,u]) + 1)
for i in ans:
  print(i)