n = int(input())
SP = []
for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    SP.append((s, p, i+1))
SP.sort(key=lambda x: (x[0], -x[1]))
for s, p, j in SP:
    print(j) n = int(input()) n int(input()) int input() input SP = [] SP [] for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    SP.append((s, p, i+1)) i range(n) range n s, p = map(str, input().split()) s map(str, input().split()) map str input().split() ().split () input split p p = int(p) p int(p) int p SP.append((s, p, i+1)) SP.append SP append (s, p, i+1) s p i+1 i 1 SP.sort(key=lambda x: (x[0], -x[1])) SP.sort SP sort key=lambda x: (x[0], -x[1]) key lambda x: (x[0], -x[1]) (x[0], -x[1]) x[0] x 0 -x[1] x[1] x 1 x for s, p, j in SP:
    print(j) s p j SP print(j) print j SP = [] [] SP p = map(str, input().split()) map(str, input().split()) p n = int(input()) int(input()) n s, p = map(str, input().split()) map(str, input().split()) s p = int(p) int(p) p
n = int(input())
SP = []
for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    SP.append((s, p, i+1))
SP.sort(key=lambda x: (x[0], -x[1]))
for s, p, j in SP:
    print(j)
