N, *AB = map(int, open(0).read().split()) for _, a, b in reversed(sorted((a / b, a, b) for a, b in zip(*[iter(AB)] * 2))): print(a, b)