from operator import itemgetter

n = int(input())
a = []
for i in range(n):
    s, p = input().split()
    a.append((i + 1, s, -int(p)))
a.sort(key=itemgetter(1, 2))
for i, _, _ in a:
    print(i) from operator import itemgetter n = int(input()) n int(input()) int input() input a = [] a [] for i in range(n):
    s, p = input().split()
    a.append((i + 1, s, -int(p))) i range(n) range n s, p = input().split() s input().split() ().split () input split p a.append((i + 1, s, -int(p))) a.append a append (i + 1, s, -int(p)) i + 1 i 1 s -int(p) int(p) int p a.sort(key=itemgetter(1, 2)) a.sort a sort key=itemgetter(1, 2) key itemgetter(1, 2) itemgetter 1 2 for i, _, _ in a:
    print(i) i _ _ a print(i) print i a = [] [] a s, p = input().split() input().split() s n = int(input()) int(input()) n p = input().split() input().split() p
from operator import itemgetter

n = int(input())
a = []
for i in range(n):
    s, p = input().split()
    a.append((i + 1, s, -int(p)))
a.sort(key=itemgetter(1, 2))
for i, _, _ in a:
    print(i)
