T = int(input()) for _ in range(T): N = int(input()) if N == 0: print(0, 0) else: p = 0 while (1 << (p + 1)) <= N: p += 1 print(1 << p, N - (1 << p))