n = int(input()) Ans = [] for _ in range(n): A,B = map(int, input().split()) Ans.append([A/B, [A, B]]) for ans in sorted(Ans)[::-1]: print(*ans[1])