n = int(input())

m = {}
for i in range(n):
  s, p = input().split()
  p = int(p)
  if s not in m:
    m[s] = []
  
  m[s].append((p, i+1))

shops = sorted(m.items(), key=lambda x : x[0])

for x in shops:
  city, scores = x[0], sorted(x[1], reverse=True, key=lambda x : x[0])
  for score in scores:
    print(score[1]) n = int(input()) n int(input()) int input() input m = {} m {} for i in range(n):
  s, p = input().split()
  p = int(p)
  if s not in m:
    m[s] = []
  
  m[s].append((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 if s not in m:
    m[s] = []
  
   s not in m s m m[s] = [] m[s] m s [] m[s].append((p, i+1)) [s].append [s] m s append (p, i+1) p i+1 i 1 shops = sorted(m.items(), key=lambda x : x[0]) shops sorted(m.items(), key=lambda x : x[0]) sorted m.items() m.items m items key=lambda x : x[0] key lambda x : x[0] x[0] x 0 x for x in shops:
  city, scores = x[0], sorted(x[1], reverse=True, key=lambda x : x[0])
  for score in scores:
    print(score[1]) x shops city, scores = x[0], sorted(x[1], reverse=True, key=lambda x : x[0]) city x[0] x 0 scores sorted(x[1], reverse=True, key=lambda x : x[0]) sorted x[1] x 1 reverse=True reverse True key=lambda x : x[0] key lambda x : x[0] x[0] x 0 x for score in scores:
    print(score[1]) score scores print(score[1]) print score[1] score 1 p = input().split() input().split() p city, scores = x[0], sorted(x[1], reverse=True, key=lambda x : x[0]) x[0] city m = {} {} m scores = x[0], sorted(x[1], reverse=True, key=lambda x : x[0]) sorted(x[1], reverse=True, key=lambda x : x[0]) scores n = int(input()) int(input()) n shops = sorted(m.items(), key=lambda x : x[0]) sorted(m.items(), key=lambda x : x[0]) shops s, p = input().split() input().split() s p = int(p) int(p) p
n = int(input())

m = {}
for i in range(n):
  s, p = input().split()
  p = int(p)
  if s not in m:
    m[s] = []
  
  m[s].append((p, i+1))

shops = sorted(m.items(), key=lambda x : x[0])

for x in shops:
  city, scores = x[0], sorted(x[1], reverse=True, key=lambda x : x[0])
  for score in scores:
    print(score[1])