from operator import itemgetter 
n = int(input())
point = []
ans = []
for i in range(n):
    a,b = input().split()
    s = [a,int(b),i+1]
    point.append(s)

s_point = sorted(point,key=itemgetter(1),reverse=True)
s_point = sorted(s_point,key=itemgetter(0))
[print(s_point[j][2]) for j in range(n)] from operator import itemgetter n = int(input()) n int(input()) int input() input point = [] point [] ans = [] ans [] for i in range(n):
    a,b = input().split()
    s = [a,int(b),i+1]
    point.append(s) i range(n) range n a,b = input().split() a input().split() ().split () input split b s = [a,int(b),i+1] s [a,int(b),i+1] a int(b) int b i+1 i 1 point.append(s) point.append point append s s_point = sorted(point,key=itemgetter(1),reverse=True) s_point sorted(point,key=itemgetter(1),reverse=True) sorted point key=itemgetter(1) key itemgetter(1) itemgetter 1 reverse=True reverse True s_point = sorted(s_point,key=itemgetter(0)) s_point sorted(s_point,key=itemgetter(0)) sorted s_point key=itemgetter(0) key itemgetter(0) itemgetter 0 print(s_point[j][2]) for j in range(n) for j in range(n) j range(n) range n for j in range(n) print(s_point[j][2]) print s_point[j][2] [j] s_point j 2 [print(s_point[j][2]) for j in range(n)] b = input().split() input().split() b point = [] [] point s = [a,int(b),i+1] [a,int(b),i+1] s s_point = sorted(s_point,key=itemgetter(0)) sorted(s_point,key=itemgetter(0)) s_point ans = [] [] ans s_point = sorted(point,key=itemgetter(1),reverse=True) sorted(point,key=itemgetter(1),reverse=True) s_point a,b = input().split() input().split() a n = int(input()) int(input()) n
from operator import itemgetter 
n = int(input())
point = []
ans = []
for i in range(n):
    a,b = input().split()
    s = [a,int(b),i+1]
    point.append(s)

s_point = sorted(point,key=itemgetter(1),reverse=True)
s_point = sorted(s_point,key=itemgetter(0))
[print(s_point[j][2]) for j in range(n)]