N = int(input())
SP = []
for i in range(N):
    S, P = input().split()
    SP.append([i+1, S, int(P)])

sort_SP = sorted(SP, key = lambda x: (x[1], -x[2]))

for ans in sort_SP:
    print(ans[0])
 N = int(input()) N int(input()) int input() input SP = [] SP [] for i in range(N):
    S, P = input().split()
    SP.append([i+1, S, int(P)]) i range(N) range N S, P = input().split() S input().split() ().split () input split P SP.append([i+1, S, int(P)]) SP.append SP append [i+1, S, int(P)] i+1 i 1 S int(P) int P sort_SP = sorted(SP, key = lambda x: (x[1], -x[2])) sort_SP 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 ans in sort_SP:
    print(ans[0]) ans sort_SP print(ans[0]) print ans[0] ans 0 sort_SP = sorted(SP, key = lambda x: (x[1], -x[2])) sorted(SP, key = lambda x: (x[1], -x[2])) sort_SP S, P = input().split() input().split() S P = input().split() input().split() P N = int(input()) int(input()) N SP = [] [] SP
N = int(input())
SP = []
for i in range(N):
    S, P = input().split()
    SP.append([i+1, S, int(P)])

sort_SP = sorted(SP, key = lambda x: (x[1], -x[2]))

for ans in sort_SP:
    print(ans[0])

