n = int(input())
d = {}
for i in range(n):
  s,p = input().split()
  if d.get(s,-1)==-1:
    d[s] = {int(p):i+1}
  else:
    d[s][int(p)] = i+1
d = sorted(d.items(), key=lambda x:x[0])
for k in d:
  l = sorted(k[1].items(), key=lambda x:x[0])[::-1]
  for t in l:
    print(t[1]) n = int(input()) n int(input()) int input() input d = {} d {} for i in range(n):
  s,p = input().split()
  if d.get(s,-1)==-1:
    d[s] = {int(p):i+1}
  else:
    d[s][int(p)] = i+1 i range(n) range n s,p = input().split() s input().split() ().split () input split p if d.get(s,-1)==-1:
    d[s] = {int(p):i+1}
  else:
    d[s][int(p)] = i+1 d.get(s,-1)==-1 d.get(s,-1) d.get d get s -1 -1 d[s] = {int(p):i+1} d[s] d s {int(p):i+1} int(p) int(p) int p i+1 i 1 d[s][int(p)] = i+1 d[s][int(p)] [s] d s int(p) int p i+1 i 1 d = sorted(d.items(), key=lambda x:x[0]) d sorted(d.items(), key=lambda x:x[0]) sorted d.items() d.items d items key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x for k in d:
  l = sorted(k[1].items(), key=lambda x:x[0])[::-1]
  for t in l:
    print(t[1]) k d l = sorted(k[1].items(), key=lambda x:x[0])[::-1] l sorted(k[1].items(), key=lambda x:x[0])[::-1] (k[1].items(), key=lambda x:x[0]) sorted k[1].items() [1].items [1] k 1 items key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x ::-1 -1 for t in l:
    print(t[1]) t l print(t[1]) print t[1] t 1 p = input().split() input().split() p s,p = input().split() input().split() s d = sorted(d.items(), key=lambda x:x[0]) sorted(d.items(), key=lambda x:x[0]) d l = sorted(k[1].items(), key=lambda x:x[0])[::-1] sorted(k[1].items(), key=lambda x:x[0])[::-1] l n = int(input()) int(input()) n d = {} {} d
n = int(input())
d = {}
for i in range(n):
  s,p = input().split()
  if d.get(s,-1)==-1:
    d[s] = {int(p):i+1}
  else:
    d[s][int(p)] = i+1
d = sorted(d.items(), key=lambda x:x[0])
for k in d:
  l = sorted(k[1].items(), key=lambda x:x[0])[::-1]
  for t in l:
    print(t[1])