import numpy as np if __name__ == "__main__": # 入力部分 n = int(input()) AB = [[int(i) for i in input().split()] for j in range(n)] # 本体 F = np.zeros(n) for i in range(len(AB)): F[i] = AB[i][0] / AB[i][1] F_index = np.argsort(F)[::-1] # 出力部分 for j in F_index: print(AB[j][0], AB[j][1])