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