n = int(input()) l = [] for i in range(n): a, b = map(int, input().split()) c = a / b l.append([c, a, b]) l = sorted(l)[::-1] for i in range(n): print(l[i][1], l[i][2])