n = int(input()) a = [map(int, input().split()) for x in range(n)] for i in sorted((x/y, (x, y)) for x, y in a)[::-1] : print(*i[1])