SP_list = []
N = int(input())

for i in range(N):
    items = input().split(' ')
    SP_list.append([i+1, items[0], int(items[1])])

SP_list.sort(key=lambda i:i[2], reverse=True)
SP_list.sort(key=lambda i:i[1])

for i in SP_list:
    print(i[0]) SP_list = [] SP_list [] N = int(input()) N int(input()) int input() input for i in range(N):
    items = input().split(' ')
    SP_list.append([i+1, items[0], int(items[1])]) i range(N) range N items = input().split(' ') items input().split(' ') ().split () input split ' ' SP_list.append([i+1, items[0], int(items[1])]) SP_list.append SP_list append [i+1, items[0], int(items[1])] i+1 i 1 items[0] items 0 int(items[1]) int items[1] items 1 SP_list.sort(key=lambda i:i[2], reverse=True) SP_list.sort SP_list sort key=lambda i:i[2] key lambda i:i[2] i[2] i 2 i reverse=True reverse True SP_list.sort(key=lambda i:i[1]) SP_list.sort SP_list sort key=lambda i:i[1] key lambda i:i[1] i[1] i 1 i for i in SP_list:
    print(i[0]) i SP_list print(i[0]) print i[0] i 0 N = int(input()) int(input()) N SP_list = [] [] SP_list items = input().split(' ') input().split(' ') items
SP_list = []
N = int(input())

for i in range(N):
    items = input().split(' ')
    SP_list.append([i+1, items[0], int(items[1])])

SP_list.sort(key=lambda i:i[2], reverse=True)
SP_list.sort(key=lambda i:i[1])

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