n = int(input()) l = [] for i in range(n): a,b = map(int,input().split()) l.append([a/b, a, b]) l = sorted(l, reverse = True) for ls in l: print(ls[1], ls[2])