from operator import itemgetter

n = int(input())
sp = [[] for _ in range(n)]
for i in range(n):
    s, p = input().split()
    p = -int(p)
    sp[i] = [s, p, i + 1]

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

n = int(input())
sp = [[] for _ in range(n)]
for i in range(n):
    s, p = input().split()
    p = -int(p)
    sp[i] = [s, p, i + 1]

sp.sort(key=itemgetter(0, 1))
for i in range(n):
    print(sp[i][2])
