N = int(input())
SP = []
for i in range(N):
    s, p = input().split()
    p = int(p)
    SP.append(list([s, p, i+1]))
SP.sort(key=lambda x: (x[0], -x[1]))
for i in SP:
    print(i[2]) 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(list([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 SP.append(list([s, p, i+1])) SP.append SP append list([s, p, i+1]) list [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 i in SP:
    print(i[2]) i SP print(i[2]) print i[2] i 2 N = int(input()) int(input()) N p = int(p) int(p) p p = input().split() input().split() p SP = [] [] SP s, p = input().split() input().split() s
N = int(input())
SP = []
for i in range(N):
    s, p = input().split()
    p = int(p)
    SP.append(list([s, p, i+1]))
SP.sort(key=lambda x: (x[0], -x[1]))
for i in SP:
    print(i[2])