n = int(input()) lst_1 = [] for _ in range(n): x,y = map(int,input().split()) lst_1 += [[x,y,x/y]] for i in range(n): for j in range(0,n-i-1,1): if lst_1[j][2] > lst_1[j+1][2]: lst_1[j] , lst_1[j+1] = lst_1[j+1] , lst_1[j] for i in range(n): print(lst_1[i][0],lst_1[i][1])