n=int(input()) A = [] B = [] for i in range(n): x1,y1=[int(i) for i in input().split()] A.append(x1) B.append(y1) num=list(range(n)) d={i:j/k for i,j,k in zip(num,A,B)} d_s=sorted(d.items(), key=lambda x:x[1],reverse=True) ans=[] for i in d_s: idx=i[0] ans.append(str(A[idx])+' '+str(B[idx])) print('\n'.join(ans))