# -*- coding: utf-8 -*- n = int(input()) ab = [[0,0,0] for i in range(n)] for i in range(n): temp = list(map(int,input().split())) ab[i][1] = temp[0] ab[i][2] = temp[1] ab[i][0] = temp[0] / temp[1] ab.sort() ab.reverse() for i in range(n): print(ab[i][1],end = " ") print(ab[i][2])