n = int(input()) d = [] for _ in range(n): a, b = map(int, input().split()) d.append((a/b, a, b)) d.sort(reverse=True) for _, x, y in d: print(x, y)