n = int(input())
res_list = []
for i in range(n):
    a,b=input().split()
    res_list.append((a,int(b)))
psorted_res_list = sorted(res_list, key=lambda x: x[1], reverse=True)
sorted_res_list = sorted(psorted_res_list, key=lambda x: x[0])
for i in range(n):
    print(res_list.index(sorted_res_list[i]) + 1) n = int(input()) n int(input()) int input() input res_list = [] res_list [] for i in range(n):
    a,b=input().split()
    res_list.append((a,int(b))) i range(n) range n a,b=input().split() a input().split() ().split () input split b res_list.append((a,int(b))) res_list.append res_list append (a,int(b)) a int(b) int b psorted_res_list = sorted(res_list, key=lambda x: x[1], reverse=True) psorted_res_list sorted(res_list, key=lambda x: x[1], reverse=True) sorted res_list key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x reverse=True reverse True sorted_res_list = sorted(psorted_res_list, key=lambda x: x[0]) sorted_res_list sorted(psorted_res_list, key=lambda x: x[0]) sorted psorted_res_list key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x for i in range(n):
    print(res_list.index(sorted_res_list[i]) + 1) i range(n) range n print(res_list.index(sorted_res_list[i]) + 1) print res_list.index(sorted_res_list[i]) + 1 res_list.index(sorted_res_list[i]) res_list.index res_list index sorted_res_list[i] sorted_res_list i 1 b=input().split() input().split() b psorted_res_list = sorted(res_list, key=lambda x: x[1], reverse=True) sorted(res_list, key=lambda x: x[1], reverse=True) psorted_res_list a,b=input().split() input().split() a sorted_res_list = sorted(psorted_res_list, key=lambda x: x[0]) sorted(psorted_res_list, key=lambda x: x[0]) sorted_res_list res_list = [] [] res_list n = int(input()) int(input()) n
n = int(input())
res_list = []
for i in range(n):
    a,b=input().split()
    res_list.append((a,int(b)))
psorted_res_list = sorted(res_list, key=lambda x: x[1], reverse=True)
sorted_res_list = sorted(psorted_res_list, key=lambda x: x[0])
for i in range(n):
    print(res_list.index(sorted_res_list[i]) + 1)