n = int(input()) l = [tuple(map(int, input().split())) for _ in range(n)] l.sort(key= lambda x: x[0]/x[1], reverse = True) for x in l: print(*x)