# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))

N = int(input())
R = []
for _ in range(N):
    a, b = inpl()
    R.append([a/b, a, b])
for r, a, b in reversed(sorted(R, key=lambda x: x[0])):
    print(a, b)