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

l = sorted(sp, key=lambda x: (x[1], -x[2]))
for a, b, c in l:
    print(a) n = int(input()) n int(input()) int input() input sp = [] sp [] for i in range(n):
    s, p = input().split()
    p = int(p)
    sp.append((i+1, s, p)) i range(n) range n s, p = input().split() s input().split() ().split () input split p p = int(p) p int(p) int p sp.append((i+1, s, p)) sp.append sp append (i+1, s, p) i+1 i 1 s p l = sorted(sp, key=lambda x: (x[1], -x[2])) l sorted(sp, key=lambda x: (x[1], -x[2])) sorted sp key=lambda x: (x[1], -x[2]) key lambda x: (x[1], -x[2]) (x[1], -x[2]) x[1] x 1 -x[2] x[2] x 2 x for a, b, c in l:
    print(a) a b c l print(a) print a p = int(p) int(p) p l = sorted(sp, key=lambda x: (x[1], -x[2])) sorted(sp, key=lambda x: (x[1], -x[2])) l p = input().split() input().split() p n = int(input()) int(input()) n s, p = input().split() input().split() s sp = [] [] sp
n = int(input())
sp = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    sp.append((i+1, s, p))

l = sorted(sp, key=lambda x: (x[1], -x[2]))
for a, b, c in l:
    print(a)