for t in sorted([x/y,[x,y]]for x,y in[map(int,input().split())for _ in[0]*int(input())])[::-1]:print(*t[1])