# unihernandez22
# https://atcoder.jp/contests/abc128/tasks/abc128_b
# implementation

n = int(input())
restaurants = []

for i in range(1, n+1):
    name, score = input().split()
    restaurants.append((name, -int(score), i))

restaurants.sort()
for i in restaurants:
    print(i[2]) n = int(input()) n int(input()) int input() input restaurants = [] restaurants [] for i in range(1, n+1):
    name, score = input().split()
    restaurants.append((name, -int(score), i)) i range(1, n+1) range 1 n+1 n 1 name, score = input().split() name input().split() ().split () input split score restaurants.append((name, -int(score), i)) restaurants.append restaurants append (name, -int(score), i) name -int(score) int(score) int score i restaurants.sort() restaurants.sort restaurants sort for i in restaurants:
    print(i[2]) i restaurants print(i[2]) print i[2] i 2 score = input().split() input().split() score n = int(input()) int(input()) n name, score = input().split() input().split() name restaurants = [] [] restaurants
# unihernandez22
# https://atcoder.jp/contests/abc128/tasks/abc128_b
# implementation

n = int(input())
restaurants = []

for i in range(1, n+1):
    name, score = input().split()
    restaurants.append((name, -int(score), i))

restaurants.sort()
for i in restaurants:
    print(i[2])
