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

s1 = sorted(s,key = lambda S:S[1],reverse=True)
s2 = sorted(s1,key = lambda S:S[0])
for i in range(n):
  print(s2[i][2]) 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 = lambda S:S[1],reverse=True) s1 sorted(s,key = lambda S:S[1],reverse=True) sorted s key = lambda S:S[1] key lambda S:S[1] S[1] S 1 S reverse=True reverse True s2 = sorted(s1,key = lambda S:S[0]) s2 sorted(s1,key = lambda S:S[0]) sorted s1 key = lambda S:S[0] key lambda S:S[0] S[0] S 0 S 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 s2 = sorted(s1,key = lambda S:S[0]) sorted(s1,key = lambda S:S[0]) s2 n = int(input()) int(input()) n s = [] [] s a , b  = input().split() input().split() a b  = input().split() input().split() b s1 = sorted(s,key = lambda S:S[1],reverse=True) sorted(s,key = lambda S:S[1],reverse=True) s1
n = int(input())
s = []
for i in range(n):
  a , b  = input().split()
  s.append((a,int(b),i+1))

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