def mainProc(lst): after = sorted(lst, key = lambda x : x[0] / x[1]) after.reverse() for l in after: print( l[0], l[1] ) if __name__ == '__main__': # 個数を取得 l = int(input()) lst = [] for i in range(l) : x, y = map(int,input().split()) lst.append((x, y)) mainProc(lst)