N = int(input())
res = [[i for i in input().split()] + [j+1] for j in range(N)]
res.sort(key = lambda x: (x[0], -int(x[1])))
print("\n".join(str(i[2]) for i in res)) N = int(input()) N int(input()) int input() input [i for i in input().split()] + [j+1] for j in range(N) for j in range(N) j range(N) range N for j in range(N) [i for i in input().split()] + [j+1] [i for i in input().split()] [j+1] j+1 j 1 res = [[i for i in input().split()] + [j+1] for j in range(N)] res [[i for i in input().split()] + [j+1] for j in range(N)] res.sort(key = lambda x: (x[0], -int(x[1]))) res.sort res sort key = lambda x: (x[0], -int(x[1])) key lambda x: (x[0], -int(x[1])) (x[0], -int(x[1])) x[0] x 0 -int(x[1]) int(x[1]) int x[1] x 1 x print("\n".join(str(i[2]) for i in res)) print "\n".join(str(i[2]) for i in res) "\n".join "\n" join str(i[2]) str i[2] i 2 res = [[i for i in input().split()] + [j+1] for j in range(N)] [[i for i in input().split()] + [j+1] for j in range(N)] res N = int(input()) int(input()) N
N = int(input())
res = [[i for i in input().split()] + [j+1] for j in range(N)]
res.sort(key = lambda x: (x[0], -int(x[1])))
print("\n".join(str(i[2]) for i in res))