def solve(): n = int(input()) x = 0 y = 0 for i in range(60): if n >> i & 1: x = 1 << i y |= x print(y - x, x) for _ in range(int(input())): solve()