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