n = int(input())
shop_list = []
for i in range(n):
    temp_list = list(input().split())
    temp_list[1] = int(temp_list[1])
    temp_list.append(i+1)
    shop_list.append(temp_list)

shop_list_sorted = sorted(shop_list,key=lambda x:(x[0],-x[1]))
for k in range(n):
    print(shop_list_sorted[k][2]) n = int(input()) n int(input()) int input() input shop_list = [] shop_list [] for i in range(n):
    temp_list = list(input().split())
    temp_list[1] = int(temp_list[1])
    temp_list.append(i+1)
    shop_list.append(temp_list) i range(n) range n temp_list = list(input().split()) temp_list list(input().split()) list input().split() ().split () input split temp_list[1] = int(temp_list[1]) temp_list[1] temp_list 1 int(temp_list[1]) int temp_list[1] temp_list 1 temp_list.append(i+1) temp_list.append temp_list append i+1 i 1 shop_list.append(temp_list) shop_list.append shop_list append temp_list shop_list_sorted = sorted(shop_list,key=lambda x:(x[0],-x[1])) shop_list_sorted sorted(shop_list,key=lambda x:(x[0],-x[1])) sorted shop_list key=lambda x:(x[0],-x[1]) key lambda x:(x[0],-x[1]) (x[0],-x[1]) x[0] x 0 -x[1] x[1] x 1 x for k in range(n):
    print(shop_list_sorted[k][2]) k range(n) range n print(shop_list_sorted[k][2]) print shop_list_sorted[k][2] [k] shop_list_sorted k 2 n = int(input()) int(input()) n temp_list = list(input().split()) list(input().split()) temp_list shop_list_sorted = sorted(shop_list,key=lambda x:(x[0],-x[1])) sorted(shop_list,key=lambda x:(x[0],-x[1])) shop_list_sorted shop_list = [] [] shop_list
n = int(input())
shop_list = []
for i in range(n):
    temp_list = list(input().split())
    temp_list[1] = int(temp_list[1])
    temp_list.append(i+1)
    shop_list.append(temp_list)

shop_list_sorted = sorted(shop_list,key=lambda x:(x[0],-x[1]))
for k in range(n):
    print(shop_list_sorted[k][2])
