n = int(input())
Restaurant = []
for i in range(n):
    cmd = input().split()
    Restaurant.append([i + 1, cmd[0], int(cmd[1])])
sorted_Restaurant = sorted(Restaurant, key=lambda x: (x[1], -x[2]))
for j in sorted_Restaurant:
    print(j[0]) n = int(input()) n int(input()) int input() input Restaurant = [] Restaurant [] for i in range(n):
    cmd = input().split()
    Restaurant.append([i + 1, cmd[0], int(cmd[1])]) i range(n) range n cmd = input().split() cmd input().split() ().split () input split Restaurant.append([i + 1, cmd[0], int(cmd[1])]) Restaurant.append Restaurant append [i + 1, cmd[0], int(cmd[1])] i + 1 i 1 cmd[0] cmd 0 int(cmd[1]) int cmd[1] cmd 1 sorted_Restaurant = sorted(Restaurant, key=lambda x: (x[1], -x[2])) sorted_Restaurant sorted(Restaurant, key=lambda x: (x[1], -x[2])) sorted Restaurant key=lambda x: (x[1], -x[2]) key lambda x: (x[1], -x[2]) (x[1], -x[2]) x[1] x 1 -x[2] x[2] x 2 x for j in sorted_Restaurant:
    print(j[0]) j sorted_Restaurant print(j[0]) print j[0] j 0 cmd = input().split() input().split() cmd sorted_Restaurant = sorted(Restaurant, key=lambda x: (x[1], -x[2])) sorted(Restaurant, key=lambda x: (x[1], -x[2])) sorted_Restaurant n = int(input()) int(input()) n Restaurant = [] [] Restaurant
n = int(input())
Restaurant = []
for i in range(n):
    cmd = input().split()
    Restaurant.append([i + 1, cmd[0], int(cmd[1])])
sorted_Restaurant = sorted(Restaurant, key=lambda x: (x[1], -x[2]))
for j in sorted_Restaurant:
    print(j[0])
