n = int(input())
guide = [[i+1, list(int(x) if x.isdigit() else x for x in input().split())] for i in range(n)]
guide = sorted(guide, key = lambda x:(x[1][0],-x[1][1]))

for i in range(n):
    print(guide[i][0]) n = int(input()) n int(input()) int input() input [i+1, list(int(x) if x.isdigit() else x for x in 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(int(x) if x.isdigit() else x for x in input().split())] i+1 i 1 list(int(x) if x.isdigit() else x for x in input().split()) list int(x) if x.isdigit() else x x.isdigit() x.isdigit x isdigit int(x) int x x guide = [[i+1, list(int(x) if x.isdigit() else x for x in input().split())] for i in range(n)] guide [[i+1, list(int(x) if x.isdigit() else x for x in input().split())] for i in range(n)] guide = sorted(guide, key = lambda x:(x[1][0],-x[1][1])) guide sorted(guide, key = lambda x:(x[1][0],-x[1][1])) sorted guide key = lambda x:(x[1][0],-x[1][1]) key lambda x:(x[1][0],-x[1][1]) (x[1][0],-x[1][1]) x[1][0] [1] x 1 0 -x[1][1] x[1][1] [1] x 1 1 x for i in range(n):
    print(guide[i][0]) i range(n) range n print(guide[i][0]) print guide[i][0] [i] guide i 0 guide = sorted(guide, key = lambda x:(x[1][0],-x[1][1])) sorted(guide, key = lambda x:(x[1][0],-x[1][1])) guide guide = [[i+1, list(int(x) if x.isdigit() else x for x in input().split())] for i in range(n)] [[i+1, list(int(x) if x.isdigit() else x for x in input().split())] for i in range(n)] guide n = int(input()) int(input()) n
n = int(input())
guide = [[i+1, list(int(x) if x.isdigit() else x for x in input().split())] for i in range(n)]
guide = sorted(guide, key = lambda x:(x[1][0],-x[1][1]))

for i in range(n):
    print(guide[i][0])