N = int(input())

my_list = []

for i in range(N):
    sp = input().split()
    sp[1] = int(sp[1])
    sp.insert(0, i+1)
    
    my_list.append(sp)
    
my_list.sort(key = lambda x: x[2], reverse=True)
my_list.sort(key = lambda x: x[1])

for i in my_list:
    print(i[0]) N = int(input()) N int(input()) int input() input my_list = [] my_list [] for i in range(N):
    sp = input().split()
    sp[1] = int(sp[1])
    sp.insert(0, i+1)
    
    my_list.append(sp)
     i range(N) range N sp = input().split() sp input().split() ().split () input split sp[1] = int(sp[1]) sp[1] sp 1 int(sp[1]) int sp[1] sp 1 sp.insert(0, i+1) sp.insert sp insert 0 i+1 i 1 my_list.append(sp) my_list.append my_list append sp my_list.sort(key = lambda x: x[2], reverse=True) my_list.sort my_list sort key = lambda x: x[2] key lambda x: x[2] x[2] x 2 x reverse=True reverse True my_list.sort(key = lambda x: x[1]) my_list.sort my_list sort key = lambda x: x[1] key lambda x: x[1] x[1] x 1 x for i in my_list:
    print(i[0]) i my_list print(i[0]) print i[0] i 0 sp = input().split() input().split() sp N = int(input()) int(input()) N my_list = [] [] my_list
N = int(input())

my_list = []

for i in range(N):
    sp = input().split()
    sp[1] = int(sp[1])
    sp.insert(0, i+1)
    
    my_list.append(sp)
    
my_list.sort(key = lambda x: x[2], reverse=True)
my_list.sort(key = lambda x: x[1])

for i in my_list:
    print(i[0])