n=int(input()) ans=[] for i in range(n): A,B=list(map(int,input().split())) ans.append((A/B,A,B)) ans=sorted(ans,reverse=True) for i,a,b in ans: print(a,b)