n = int(input()) L = [list(map(int, input().split())) for i in range(n)] K = [] for i in range(len(L)): K.append(([i, L[i][0] / L[i][1]])) A = sorted(K, reverse=True, key=lambda x: x[1]) for k in range(n): print(L[A[k][0]][0], L[A[k][0]][1])