n=int(input())
dic1={}
bokk=[]
list0=[]
for i in range(n):
  c,p=map(str,input().split())
  p=int(p)
  list0.append([c,p])
  if c not in dic1:
    dic1[c]=[]
  dic1[c].append(p)
dic1=dict(sorted(dic1.items()))
for i,k in dic1.items():
  k.sort(reverse=True)
  for j in k:
    bokk.append([i,j])
for i in bokk:
  print(list0.index(i)+1) n=int(input()) n int(input()) int input() input dic1={} dic1 {} bokk=[] bokk [] list0=[] list0 [] for i in range(n):
  c,p=map(str,input().split())
  p=int(p)
  list0.append([c,p])
  if c not in dic1:
    dic1[c]=[]
  dic1[c].append(p) i range(n) range n c,p=map(str,input().split()) c map(str,input().split()) map str input().split() ().split () input split p p=int(p) p int(p) int p list0.append([c,p]) list0.append list0 append [c,p] c p if c not in dic1:
    dic1[c]=[]
   c not in dic1 c dic1 dic1[c]=[] dic1[c] dic1 c [] dic1[c].append(p) [c].append [c] dic1 c append p dic1=dict(sorted(dic1.items())) dic1 dict(sorted(dic1.items())) dict sorted(dic1.items()) sorted dic1.items() dic1.items dic1 items for i,k in dic1.items():
  k.sort(reverse=True)
  for j in k:
    bokk.append([i,j]) i k dic1.items() dic1.items dic1 items k.sort(reverse=True) k.sort k sort reverse=True reverse True for j in k:
    bokk.append([i,j]) j k bokk.append([i,j]) bokk.append bokk append [i,j] i j for i in bokk:
  print(list0.index(i)+1) i bokk print(list0.index(i)+1) print list0.index(i)+1 list0.index(i) list0.index list0 index i 1 list0=[] [] list0 p=map(str,input().split()) map(str,input().split()) p p=int(p) int(p) p bokk=[] [] bokk c,p=map(str,input().split()) map(str,input().split()) c dic1=dict(sorted(dic1.items())) dict(sorted(dic1.items())) dic1 n=int(input()) int(input()) n dic1={} {} dic1
n=int(input())
dic1={}
bokk=[]
list0=[]
for i in range(n):
  c,p=map(str,input().split())
  p=int(p)
  list0.append([c,p])
  if c not in dic1:
    dic1[c]=[]
  dic1[c].append(p)
dic1=dict(sorted(dic1.items()))
for i,k in dic1.items():
  k.sort(reverse=True)
  for j in k:
    bokk.append([i,j])
for i in bokk:
  print(list0.index(i)+1)