n = int(input()) AB = [list(map(int,input().split())) for _ in range(n)] ans = [[i,AB[i][0] / AB[i][1]] for i in range(n)] sorted_AB = sorted(ans, key=lambda x:x[1],reverse=True) for i in range(n): print(AB[sorted_AB[i][0]][0],AB[sorted_AB[i][0]][1])