T=int(input()) for i in range(T): N=int(input()) if N==0: print(0,0) else: c=bin(N)[2:] p=pow(2,len(c)-1) print(p,N-p)