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