n = int(input())

r = []

for i in range(n):
    city, score = input().split()
    score = int (score)
    r.append((i+1, city, score))

r.sort(key=lambda x:x[2], reverse=True)
r.sort(key=lambda x:x[1])

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

r = []

for i in range(n):
    city, score = input().split()
    score = int (score)
    r.append((i+1, city, score))

r.sort(key=lambda x:x[2], reverse=True)
r.sort(key=lambda x:x[1])

for i in range(n):
    print(r[i][0])