N = int(input())
S = [[i + 1] + list(input().split()) for i in range(N)]

for s in sorted(S, key=lambda x: (x[1], -int(x[2]))):
    print(s[0]) N = int(input()) N int(input()) int input() input [i + 1] + list(input().split()) for i in range(N) for i in range(N) i range(N) range N for i in range(N) [i + 1] + list(input().split()) [i + 1] i + 1 i 1 list(input().split()) list input().split() ().split () input split S = [[i + 1] + list(input().split()) for i in range(N)] S [[i + 1] + list(input().split()) for i in range(N)] for s in sorted(S, key=lambda x: (x[1], -int(x[2]))):
    print(s[0]) s sorted(S, key=lambda x: (x[1], -int(x[2]))) sorted S key=lambda x: (x[1], -int(x[2])) key lambda x: (x[1], -int(x[2])) (x[1], -int(x[2])) x[1] x 1 -int(x[2]) int(x[2]) int x[2] x 2 x print(s[0]) print s[0] s 0 N = int(input()) int(input()) N S = [[i + 1] + list(input().split()) for i in range(N)] [[i + 1] + list(input().split()) for i in range(N)] S
N = int(input())
S = [[i + 1] + list(input().split()) for i in range(N)]

for s in sorted(S, key=lambda x: (x[1], -int(x[2]))):
    print(s[0])
