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