import copy
n = int(input())
r = []
for _ in range(n):
    city, x = input().split()
    x = int(x)
    r.append((city, x))

d = copy.deepcopy(r)
d = sorted(d, key=lambda x: -x[1])
d = sorted(d, key=lambda x: x[0])

for k in d:
    print(r.index(k) + 1) import copy copy n = int(input()) n int(input()) int input() input r = [] r [] for _ in range(n):
    city, x = input().split()
    x = int(x)
    r.append((city, x)) _ range(n) range n city, x = input().split() city input().split() ().split () input split x x = int(x) x int(x) int x r.append((city, x)) r.append r append (city, x) city x d = copy.deepcopy(r) d copy.deepcopy(r) copy.deepcopy copy deepcopy r d = sorted(d, key=lambda x: -x[1]) d sorted(d, key=lambda x: -x[1]) sorted d key=lambda x: -x[1] key lambda x: -x[1] -x[1] x[1] x 1 x d = sorted(d, key=lambda x: x[0]) d sorted(d, key=lambda x: x[0]) sorted d key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x for k in d:
    print(r.index(k) + 1) k d print(r.index(k) + 1) print r.index(k) + 1 r.index(k) r.index r index k 1 x = input().split() input().split() x city, x = input().split() input().split() city r = [] [] r d = sorted(d, key=lambda x: x[0]) sorted(d, key=lambda x: x[0]) d d = copy.deepcopy(r) copy.deepcopy(r) d d = sorted(d, key=lambda x: -x[1]) sorted(d, key=lambda x: -x[1]) d x = int(x) int(x) x n = int(input()) int(input()) n
import copy
n = int(input())
r = []
for _ in range(n):
    city, x = input().split()
    x = int(x)
    r.append((city, x))

d = copy.deepcopy(r)
d = sorted(d, key=lambda x: -x[1])
d = sorted(d, key=lambda x: x[0])

for k in d:
    print(r.index(k) + 1)
