N = int(input()) L = [] for _ in range(N): a, b = map(int, input().split()) L.append([a/b, a, b]) L = sorted(L)[::-1] for n, i, j in L: print(i, j)