N = int(input())
l = []

for i in range(N):
  s,p = input().split()
  l.append([i+1,[s,-int(p)]])
  
sl = sorted(l,key=lambda w: w[1])
for w in sl:
  print(w[0]) N = int(input()) N int(input()) int input() input l = [] l [] for i in range(N):
  s,p = input().split()
  l.append([i+1,[s,-int(p)]])
   i range(N) range N s,p = input().split() s input().split() ().split () input split p l.append([i+1,[s,-int(p)]]) l.append l append [i+1,[s,-int(p)]] i+1 i 1 [s,-int(p)] s -int(p) int(p) int p sl = sorted(l,key=lambda w: w[1]) sl sorted(l,key=lambda w: w[1]) sorted l key=lambda w: w[1] key lambda w: w[1] w[1] w 1 w for w in sl:
  print(w[0]) w sl print(w[0]) print w[0] w 0 sl = sorted(l,key=lambda w: w[1]) sorted(l,key=lambda w: w[1]) sl l = [] [] l N = int(input()) int(input()) N p = input().split() input().split() p s,p = input().split() input().split() s
N = int(input())
l = []

for i in range(N):
  s,p = input().split()
  l.append([i+1,[s,-int(p)]])
  
sl = sorted(l,key=lambda w: w[1])
for w in sl:
  print(w[0])