n = int(input()); dic = {} for _ in range(n): bunshi, bunbo = map(int, input().split()) dic[bunshi/bunbo] = str(bunshi) + " " + str(bunbo) for key in sorted(dic.keys(), reversed=True): print(dic[key])