N = int(input())
 
city = []
for i in range(N):
    s, p = input().split()
    city.append([s, int(p), i+1])
city.sort(key=lambda city: (city[0], -city[1]))
 
for i in city:
    print(i[2]) N = int(input()) N int(input()) int input() input city = [] city [] for i in range(N):
    s, p = input().split()
    city.append([s, int(p), i+1]) i range(N) range N s, p = input().split() s input().split() ().split () input split p city.append([s, int(p), i+1]) city.append city append [s, int(p), i+1] s int(p) int p i+1 i 1 city.sort(key=lambda city: (city[0], -city[1])) city.sort city sort key=lambda city: (city[0], -city[1]) key lambda city: (city[0], -city[1]) (city[0], -city[1]) city[0] city 0 -city[1] city[1] city 1 city for i in city:
    print(i[2]) i city print(i[2]) print i[2] i 2 city = [] [] city s, p = input().split() input().split() s N = int(input()) int(input()) N p = input().split() input().split() p
N = int(input())
 
city = []
for i in range(N):
    s, p = input().split()
    city.append([s, int(p), i+1])
city.sort(key=lambda city: (city[0], -city[1]))
 
for i in city:
    print(i[2])