n = int(input())
city = []
l = []
for i in range(n):
  s,p = input().split()
  if s not in city: city.append(s)
  l.append((s, int(p), i+1))
  
city = sorted(set(city))
l = sorted(l, key=lambda x: x[1], reverse=True)
for i in city:
  for j in l:
    if i == j[0]: print(j[2]) n = int(input()) n int(input()) int input() input city = [] city [] l = [] l [] for i in range(n):
  s,p = input().split()
  if s not in city: city.append(s)
  l.append((s, int(p), i+1))
   i range(n) range n s,p = input().split() s input().split() ().split () input split p if s not in city: city.append(s)
   s not in city s city l.append((s, int(p), i+1)) l.append l append (s, int(p), i+1) s int(p) int p i+1 i 1 city = sorted(set(city)) city sorted(set(city)) sorted set(city) set city l = sorted(l, key=lambda x: x[1], reverse=True) l sorted(l, key=lambda x: x[1], reverse=True) sorted l key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x reverse=True reverse True for i in city:
  for j in l:
    if i == j[0]: print(j[2]) i city for j in l:
    if i == j[0]: print(j[2]) j l if i == j[0]: print(j[2]) i == j[0] i j[0] j 0 p = input().split() input().split() p n = int(input()) int(input()) n l = [] [] l s,p = input().split() input().split() s city = [] [] city city = sorted(set(city)) sorted(set(city)) city l = sorted(l, key=lambda x: x[1], reverse=True) sorted(l, key=lambda x: x[1], reverse=True) l
n = int(input())
city = []
l = []
for i in range(n):
  s,p = input().split()
  if s not in city: city.append(s)
  l.append((s, int(p), i+1))
  
city = sorted(set(city))
l = sorted(l, key=lambda x: x[1], reverse=True)
for i in city:
  for j in l:
    if i == j[0]: print(j[2])