N = int(input()) AB = [list(map(int, input().split())) for _ in range(N)] AB.sort(reverse=True, key=lambda x:x[0]/x[1]) for ab in AB: print(*ab)