N = int(input()) l = []*N for _ in range(N): A,B = map(int,input().split()) l.append([A/B,A,B]) l.sort(reverse=True) for i in range(N): print(l[i][1],l[i][2])