num = int(input()) array=[] for i in range(num): a,b = list(map(int,input().split())) array.append([a/b,a,b]) array.sort() x = num -1 while x > -1: print(array[x][1],array[x][2]) x = x - 1