n = int(input()) l1 = [] l2 = [] for i in range(n): tmp = input() l1.append(int(tmp.split(" ")[0])) l2.append(int(tmp.split(" ")[1])) l3 = [ l1[i] / l2[i] for i in range(n)] l4 = sorted(l3,reverse=True) ilist = [l3.index(i) for i in l4] for i in ilist: print( str(l1[i]) + " " + str(l2[i]))