import operator as op

n = int(input())
s = []
for i in range(n):
  a , b  = input().split()
  s.append((a,int(b),i+1))

s1 = sorted(s,key = op.itemgetter(1),reverse=True)
s2 = sorted(s1,key = op.itemgetter(0))
for i in range(n):
  print(s2[i][2]) import operator as op operator n = int(input()) n int(input()) int input() input s = [] s [] for i in range(n):
  a , b  = input().split()
  s.append((a,int(b),i+1)) i range(n) range n a , b  = input().split() a input().split() ().split () input split b s.append((a,int(b),i+1)) s.append s append (a,int(b),i+1) a int(b) int b i+1 i 1 s1 = sorted(s,key = op.itemgetter(1),reverse=True) s1 sorted(s,key = op.itemgetter(1),reverse=True) sorted s key = op.itemgetter(1) key op.itemgetter(1) op.itemgetter op itemgetter 1 reverse=True reverse True s2 = sorted(s1,key = op.itemgetter(0)) s2 sorted(s1,key = op.itemgetter(0)) sorted s1 key = op.itemgetter(0) key op.itemgetter(0) op.itemgetter op itemgetter 0 for i in range(n):
  print(s2[i][2]) i range(n) range n print(s2[i][2]) print s2[i][2] [i] s2 i 2 s1 = sorted(s,key = op.itemgetter(1),reverse=True) sorted(s,key = op.itemgetter(1),reverse=True) s1 n = int(input()) int(input()) n b  = input().split() input().split() b a , b  = input().split() input().split() a s = [] [] s s2 = sorted(s1,key = op.itemgetter(0)) sorted(s1,key = op.itemgetter(0)) s2
import operator as op

n = int(input())
s = []
for i in range(n):
  a , b  = input().split()
  s.append((a,int(b),i+1))

s1 = sorted(s,key = op.itemgetter(1),reverse=True)
s2 = sorted(s1,key = op.itemgetter(0))
for i in range(n):
  print(s2[i][2])