n = int(input())
sp = []
for i in range(n):
    city, point = input().split()
    sp.append([city, int(point), int(i+1)])

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

sp.sort(key=lambda x: x[1], reverse=True)
sp.sort(key=lambda x: x[0])
for i in sp:
    print(i[2])
