n = int(input()) d = {} for _ in range(n): a, b = map(int, input().split()) d[a/b] = str(a) + ' ' + str(b) for i, value in sorted(d.items(), reverse=True): print(value)