N=int(input())
restaurants = []
for i in range(N):
    S,P = input().split()
    P = int(P)
    restaurants.append([i+1,S, P])

restaurants.sort(key=lambda x: (x[1], -x[2]))

for r in restaurants:
    print(r[0]) N=int(input()) N int(input()) int input() input restaurants = [] restaurants [] for i in range(N):
    S,P = input().split()
    P = int(P)
    restaurants.append([i+1,S, P]) i range(N) range N S,P = input().split() S input().split() ().split () input split P P = int(P) P int(P) int P restaurants.append([i+1,S, P]) restaurants.append restaurants append [i+1,S, P] i+1 i 1 S P restaurants.sort(key=lambda x: (x[1], -x[2])) restaurants.sort restaurants sort 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 r in restaurants:
    print(r[0]) r restaurants print(r[0]) print r[0] r 0 P = int(P) int(P) P S,P = input().split() input().split() S P = input().split() input().split() P N=int(input()) int(input()) N restaurants = [] [] restaurants
N=int(input())
restaurants = []
for i in range(N):
    S,P = input().split()
    P = int(P)
    restaurants.append([i+1,S, P])

restaurants.sort(key=lambda x: (x[1], -x[2]))

for r in restaurants:
    print(r[0])