N = int(input())
restaurants = []
for i in range(N):
    name, rating = input().split()
    restaurants.append([name, -int(rating), i])
restaurants.sort()
for i in restaurants:
    print(i[2] + 1) N = int(input()) N int(input()) int input() input restaurants = [] restaurants [] for i in range(N):
    name, rating = input().split()
    restaurants.append([name, -int(rating), i]) i range(N) range N name, rating = input().split() name input().split() ().split () input split rating restaurants.append([name, -int(rating), i]) restaurants.append restaurants append [name, -int(rating), i] name -int(rating) int(rating) int rating i restaurants.sort() restaurants.sort restaurants sort for i in restaurants:
    print(i[2] + 1) i restaurants print(i[2] + 1) print i[2] + 1 i[2] i 2 1 name, rating = input().split() input().split() name rating = input().split() input().split() rating N = int(input()) int(input()) N restaurants = [] [] restaurants
N = int(input())
restaurants = []
for i in range(N):
    name, rating = input().split()
    restaurants.append([name, -int(rating), i])
restaurants.sort()
for i in restaurants:
    print(i[2] + 1)
