n = int(input()) xy = [map(int, input().split()) for _ in range(n)] x, y = [list(i) for i in zip(*xy)] l = [] for i in range(n): l.append(x[i]/y[i]) l.sort() l.reverse() for i in range(n): for j in range(n): if x[j]/y[j]==l[i]: print(x[j],y[j]) else: pass