Vlad found two positive numbers $a$ and $b$ ($a,b>0$). He discovered that $a \oplus b = \frac{a + b}{2}$, where $\oplus$ means the bitwise exclusive OR , and division is performed without rounding..

Since it is easier to remember one number than two, Vlad remembered only $a\oplus b$, let's denote this number as $x$. Help him find any suitable $a$ and $b$ or tell him that they do not exist.


-----Input-----

The first line of the input data contains the single integer $t$ ($1 \le t \le 10^4$) — the number of test cases in the test.

Each test case is described by a single integer $x$ ($1 \le x \le 2^{29}$) — the number that Vlad remembered.


-----Output-----

Output $t$ lines, each of which is the answer to the corresponding test case. As the answer, output $a$ and $b$ ($0 < a,b \le 2^{32}$), such that $x = a \oplus b = \frac{a + b}{2}$. If there are several answers, output any of them. If there are no matching pairs, output -1.


-----Examples-----

Input
6
2
5
10
6
18
36
Output
3 1
-1
13 7
-1
25 11
50 22


-----Note-----

None

Difficulty: MEDIUM

Solutions:
for n in [*map(int, open(0))][1:]:
	b = n >> 1
	print(*[b * 3, -1, b][bool(n & 1 or n & b)::2])


def solve():
	x = int(input())
	if x % 2 == 1:
		print(-1)
		return
	rest = x // 2
	if x & rest == 0:
		print(x + rest, rest)
	else:
		print(-1)
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	a = int(input())
	if a % 2:
		print(-1)
	elif 3 * a // 2 ^ a // 2 == a:
		print(3 * a // 2, a // 2)
	else:
		print(-1)


def find_pair(x):
	if x % 2 == 1:
		return -1
	a = x + x // 2
	b = x - x // 2
	if a ^ b == x:
		return (a, b)
	else:
		return -1
t = int(input())
for _ in range(t):
	x = int(input())
	ans = find_pair(x)
	if type(ans) == int:
		print(-1)
	else:
		print(ans[0], ans[1])


for _ in range(int(input())):
	x = int(input())
	if x % 2 == 1:
		print(-1)
		continue
	m = x // 2
	n = x // 2
	if m & x:
		print(-1)
		continue
	print(m + x, n)


tdr_F = int(input())
for i in range(tdr_F):
	CSd_fg = int(input())
	if CSd_fg % 2 == 1:
		print(-1)
	else:
		bSf_d = CSd_fg + CSd_fg // 2
		k_po_j = CSd_fg // 2
		if bSf_d ^ k_po_j == CSd_fg:
			print(bSf_d, k_po_j)
		else:
			print(-1)


n = int(input())
for i in range(n):
	x = int(input())
	if x % 2 == 1:
		print(-1)
	else:
		a = x + x // 2
		b = x // 2
		if a ^ b == x:
			print(a, b)
		else:
			print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	bl = True
	if n & 1:
		bl = False
	a = n // 2
	if a & n or not bl:
		print(-1)
	else:
		print(a | n, a)


t = int(input())
while t:
	x = int(input())
	a = x + x // 2
	b = x // 2
	if x % 2 == 1:
		print(-1)
	elif a ^ b == x:
		print(a, b)
	else:
		print(-1)
	t -= 1


for i in range(int(input())):
	s = int(input())
	a = 3 * s // 2
	b = s // 2
	if s == a ^ b and s - a / 2 - b / 2 == 0.0:
		print(a, b)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	if not n % 2:
		n2 = int(n / 2)
		if n + n2 ^ n - n2 == n:
			print(f'{n + n2} {n - n2}')
			continue
		else:
			print(-1)
	else:
		print(-1)


for _ in range(int(input())):
	if (p := (3 * (x := int(input())) // 2)) ^ (b := (x // 2)) == x == (p + b) // 2:
		print(p, b)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	a = 2 * n
	if a - n // 2 ^ n // 2 == n:
		print(a - n // 2, n // 2)
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	a = 3 * n // 2
	b = n // 2
	if n == a ^ b and 2 * n == a + b:
		print(a, b)
	else:
		print(-1)


t = int(input())
for _ in range(0, t):
	x = int(input())
	if x % 2 == 1:
		print('-1')
	else:
		a = int(3 * x / 2)
		b = int(x / 2)
		if a ^ b == x:
			print(f'{a} {b}')
		else:
			print('-1')


for _ in range(int(input())):
	x = int(input())
	if x % 2 == 1:
		print(-1)
	else:
		a = x + x // 2
		b = x // 2
		if a ^ b == x:
			print(a, b)
		else:
			print(-1)


t = int(input())
while t:
	n = int(input())
	if n % 2 != 0:
		print(-1)
	else:
		a = int(3 * n / 2)
		b = int(n / 2)
		if int((a + b) / 2) == a ^ b:
			print(a, b)
		else:
			print(-1)
	t -= 1


for __ in range(int(input())):
	x = int(input())
	(a, b) = (x // 2 * 3, x // 2)
	if a ^ b == x:
		print(a, b)
	else:
		print('-1')


import math
import random
import statistics
from collections import Counter
import heapq
import operator
import itertools
import sys
import functools
import bisect
import copy
KPMOD = 1000000007

def KPMODINV(a, KPMOD=1000000007):
	return KPPOW(a, KPMOD - 2)

def KPMULT(a, b):
	return a % KPMOD * (b % KPMOD) % KPMOD

def KPADD(a, b):
	return (a % KPMOD + b % KPMOD) % KPMOD

def KPPOW(a, b):
	if b == 0:
		return 1
	res = KPPOW(a, b // 2) % KPMOD
	if b % 2:
		return res * res * a % KPMOD
	else:
		return res * res % KPMOD
for _ in range(int(input())):
	KPN = int(input())
	if KPN // 2 & KPN:
		print(-1)
	elif KPN & 1:
		print(-1)
	else:
		print(KPN * 6 // 4, KPN // 2)


t = int(input())
for _ in range(t):
	x = int(input())
	binary = bin(x)[2:]
	a = int(len(binary) * '1', 2)
	b = int(binary.replace('0', '_').replace('1', '0').replace('_', '1'), 2)
	k = (a + b) // 2
	if (a + b) % 2 != 0 or a == 0 or b == 0 or (k < x):
		print(-1)
		continue
	diff = k - x
	a -= diff
	b -= diff
	if a <= 0 or b <= 0 or x != (a + b) // 2 or (a ^ b != x):
		print(-1)
		continue
	else:
		print(a, b)


import functools
import sys
from collections import defaultdict
import collections
import math
import heapq

def solve(N):
	arr = bin(N)[2:]
	arr_a = list(arr)
	arr_b = ['0'] * len(arr)
	curr_sum = N
	needed_sum = N
	if needed_sum % 2 == 1:
		return -1
	else:
		target_sum = needed_sum // 2
	new_arr = int(bin(target_sum)[2:].zfill(len(arr)), 2)
	if new_arr & N > 0:
		return -1
	else:
		res = []
		res.append(new_arr | N)
		res.append(new_arr)
		return ' '.join([str(x) for x in res])
t = int(input())
for j in range(1, t + 1):
	N = int(input())
	result = solve(N)
	print(result)


def main():
	n = int(input())
	if n % 2:
		print(-1)
		return
	b = bin(n)
	b = b[2:]
	alt = ['0'] * len(b)
	b = list(b)
	i = 0
	while i < len(b) - 1:
		if b[i] == '1':
			if b[i + 1] == '1':
				print(-1)
				return
			b[i + 1] = '1'
			alt[i + 1] = '1'
			i += 1
		i += 1
	b = ''.join(b)
	alt = ''.join(alt)
	a1 = int(b, 2)
	a2 = int(alt, 2)
	print(a1, a2)
	return
for _ in range(int(input())):
	main()


from math import gcd
from sys import setrecursionlimit
setrecursionlimit(10 ** 6)

def ye():
	print('Yes')

def no():
	print('NO')

def solve():
	intx = int(input())
	x = bin(intx)[2:]
	if x[-1] == '1':
		print(-1)
		return
	for i in range(1, len(x)):
		if x[i] == '1' and x[i] == x[i - 1]:
			print(-1)
			return
	print(intx * 3 // 2, intx // 2)
	return
TT_T = int(input())
while TT_T:
	solve()
	TT_T -= 1


for a in range(int(input())):
	n = int(input()) << 1
	s = '0' + bin(n)[2:]
	(c, d) = (0, 0)
	if n % 4 != 0:
		print(-1)
	else:
		n1 = len(s)
		for b in range(1, n1):
			if s[b] == '1' and s[b - 1] == '1':
				print(-1)
				break
		else:
			print(n - (n >> 2), n >> 2)


def main():
	_i = int(input())
	for _ in range(_i):
		n = int(input().strip('\r\n'))
		a1 = ''
		a2 = ''
		sn = f'{n:b}'
		i = 0
		fail = False
		while i < len(sn):
			if sn[i] == '1':
				if i == len(sn) - 1 or sn[i + 1] != '0':
					fail = True
					break
				a1 = a1 + '11'
				a2 = a2 + '01'
				i += 1
			else:
				a1 = a1 + '0'
				a2 = a2 + '0'
			i += 1
		if fail:
			print('-1')
		else:
			print(int(a1, 2), int(a2, 2))
main()


cases = int(input())

def main():
	for case in range(cases):
		x = int(input())
		n = 2 * x
		if x % 2:
			print(-1)
			continue
		a = 0
		b = 0
		wr = bin(x)[:1:-1]
		wr += '0'
		pow2 = 1
		xs = []
		for (i, d) in enumerate(wr):
			if d == '1':
				a += pow2
			else:
				xs.append(pow2)
			pow2 *= 2
		while xs:
			p = xs.pop()
			if a + b + 2 * p <= n:
				a += p
				b += p
		if a + b == n:
			print(a, b)
		else:
			print(-1)
main()


import os
import math
import collections
import bisect
import functools
import itertools
import heapq

def solve(x):
	if x & 1:
		return [-1]
	and_val = x // 2
	sa = '{0:b}'.format(and_val)
	sx = '{0:b}'.format(x)
	if len(sa) < len(sx):
		sa = sa.zfill(len(sx))
	if len(sx) < len(sa):
		sx = sx.zfill(len(sa))
	(a, b) = (['0'] * len(sx), ['0'] * len(sx))
	for i in range(len(sx)):
		if sa[i] == '0' and sx[i] == '0':
			continue
		elif sa[i] == '1' and sx[i] == '0':
			a[i] = '1'
			b[i] = '1'
		elif sa[i] == '0' and sx[i] == '1':
			a[i] = '1'
		else:
			return [-1]
	return [int(''.join(a), 2), int(''.join(b), 2)]
t = int(input())
for _ in range(t):
	x = int(input())
	res = solve(x)
	print(' '.join(map(str, res)))


t = int(input())
for test in range(t):
	x = int(input())
	y = bin(x)
	(a, b) = (0, 0)
	i = 2
	while i < len(y):
		if y[i:i + 2] == '10':
			(a, b) = (a << 2 | 3, b << 2 | 1)
			i += 2
		elif y[i:i + 1] == '0':
			(a, b) = (a << 1, b << 1)
			i += 1
		else:
			(a, b) = (None, None)
			break
	if a and b:
		print(a, b)
	else:
		print(-1)


t = int(input())
for i in range(0, t):
	n = int(input())

	def solve(num):
		a = 0
		b = 0
		last = 0
		ok = 1
		tmp = -1
		while num > 0:
			w = num & 1
			num >>= 1
			tmp += 1
			if tmp == 0 and w == 1:
				ok = 0
				break
			if w == 1 and last == 1:
				ok = 0
				break
			if w == 1:
				a += 1 << tmp
				if tmp > 0:
					a += 1 << tmp - 1
					b += 1 << tmp - 1
			last = w
		if ok == 1:
			print(a, b)
		else:
			print(-1)
	solve(n)
	pass


import math

def main():
	t = int(input())
	for _ in range(t):
		res = alg()
		print(res)

def alg():
	x = int(input())
	s = x // 2
	a = 0
	b = 0
	res = 0
	for i in range(32):
		Xi = x & 1 << i
		Si = s & 1 << i
		if Xi == 0 and Si > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Si == 0:
			a = 1 << i | a
		elif Xi > 0 and Si == 0:
			res = -1
			break
	if res == 0:
		if a + b == 2 * (a ^ b):
			res = str(a) + ' ' + str(b)
		else:
			res = -1
	return res
main()


def func():
	x = int(input())
	if x % 2 == 1:
		print(-1)
		return
	a = 0
	v = []
	t = x
	p = 1
	while t != 0:
		y = t % 2
		t = t // 2
		if y == 0:
			v.append(p)
		else:
			a += p
		p *= 2
	t = x - a // 2
	p = 1
	b = 0
	while t != 0:
		y = t % 2
		t = t // 2
		if y == 1:
			if p not in v:
				print(-1)
				return
			b += p
		p *= 2
	print(a + b, b)
for i in range(int(input())):
	func()


import math
test_cases = int(input())
for _ in range(test_cases):
	xor = int(input())
	first = xor
	second = 0
	for index in range(math.ceil(math.log2(xor)), -1, -1):
		power_2 = 1 << index
		if xor & power_2 > 1:
			continue
		if 2 * xor - (first + second) >= power_2 << 1:
			first += power_2
			second += power_2
	if first + second == 2 * xor and first ^ second == xor:
		print(first, second)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	x = int(input())
	a = x
	b = 0
	for i in range(32, -1, -1):
		if x & 1 << i > 0:
			continue
		if 2 * x - a - b >= 2 << i:
			a += 1 << i
			b += 1 << i
	if a + b == 2 * x and a ^ b == x:
		print(a, b)
	else:
		print(-1)


import sys
input = lambda : sys.stdin.readline().strip()

def compute(S, X):
	if (S - X) % 2 != 0:
		return [-1]
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return [-1]
	return [a, b]

def solve():
	n = int(input())
	a = compute(n * 2, n)
	print(*a)
for i in range(int(input())):
	solve()


import sys

def rec(mask, s, x, bit, a, b):
	if s == 0 and bit == 0:
		return [a, b]
	if x & 1:
		if s & 1 == 1 + bit & 1:
			return rec(mask << 1, s >> 1, x >> 1, bit + 1 >> 1, a | mask, b)
	else:
		r = None
		if bit + 1 + 1 & 1 == s & 1:
			r = rec(mask << 1, s >> 1, x >> 1, bit + 1 + 1 >> 1, a | mask, b | mask)
		if not r and bit == s & 1:
			r = rec(mask << 1, s >> 1, x >> 1, 0, a, b)
		if r:
			return r
	return None

def solve():
	x = int(data.readline())
	s = x << 1
	r = rec(1, s, x, 0, 0, 0)
	if r:
		print(*r)
	else:
		print(-1)
data = sys.stdin
total_tests = int(data.readline())
for test in range(total_tests):
	solve()


t = int(input())
for i in range(t):
	x = int(input())
	y = x // 2
	a = 0
	b = 0
	ca = 1
	ind = 0
	if x % 2 == 1:
		print(-1)
		continue
	while x > 0:
		tx = x % 2
		ty = y % 2
		if tx == 0 and ty == 1:
			a += ca
			b += ca
		elif tx == 1 and ty == 0:
			a += ca
		elif tx == 1 and ty == 1:
			ind = 1
		if ind == 1:
			break
		ca *= 2
		x //= 2
		y //= 2
	if ind == 1:
		print(-1)
	else:
		print(a, b)


def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return [-1, -1]
	return [a, b]

def solve():
	x = int(input())
	[a, b] = compute(x * 2, x)
	if a ^ b == x and (a + b) / 2 == x:
		print(a, b)
	else:
		print(-1)
	return
	print('RR', x % 4)
	for i in range(x):
		if x + i > 2 ** 32:
			break
		if x - i ^ x + i == x:
			print(x - i, x + i)
			a = x - i
			b = x + i
			c = a & b
			return
			print(f'{a:>08b} {b:>08b}  {x:>08b} {c:>08b} ')
	print(-1)
for t in range(int(input())):
	solve()


import sys
N = int(200000.0 + 5)
sys.setrecursionlimit(N)

def charming():
	x = int(input())
	if x & 1 == 1:
		print(-1)
		return
	two = list()
	for i in range(32):
		if x // pow(2, i) & 1:
			two.append(i)
	a = x + pow(2, two[0] - 1)
	b = pow(2, two[0] - 1)
	for i in range(1, len(two)):
		if two[i] == two[i - 1] + 1:
			print(-1)
			return
		a += pow(2, two[i] - 1)
		b += pow(2, two[i] - 1)
	if a ^ b == (a + b) // 2:
		print(a, b)
	else:
		print(-1)
for t in range(int(input())):
	charming()


def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			print(-1)
			return
	print(a, b)
for i in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print(-1)
	else:
		compute(2 * n, n)


def check(s, xor):
	a2 = (s - xor) // 2
	a = 0
	b = 0
	for i in range(64):
		x1 = xor & 1 << i
		a1 = a2 & 1 << i
		if x1 == 0 and a1 == 0:
			pass
		elif x1 == 0 and a1 > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif x1 > 0 and a1 == 0:
			a = 1 << i | a
		else:
			return [-1]
	if (a + b) % 2 == 0:
		data = [a, b]
		return data
	else:
		return [-1]
for _ in range(int(input())):
	n = int(input())
	m = 2 * n
	val = check(m, n)
	print(*val)


import collections

def compute(s, x):
	av = (s - x) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = x & 1 << i
		Ai = av & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			print(-1)
			return
	if a + b == s:
		print(a, b)
	else:
		print(-1)
for _ in range(int(input())):
	n = int(input())
	x = n
	s = 2 * n
	compute(s, x)


def N():
	return int(input())

def A():
	return [int(x) for x in input().split()]

def S():
	return input()

def decimalToBinary(n):
	return bin(n).replace('0b', '')
for _ in range(N()):
	n = N()
	a = []
	f = n % 2 == 0
	p = 0
	b = []
	if 'codeforces' == 28226329:
		print('Tanmay')
	for i in range(32, -1, -1):
		bit = n >> i & 1
		if p == 1 and bit == 1:
			f = False
			break
		if bit == 1:
			a.append(1)
			b.append(0)
		elif p == 1:
			a.append(1)
			b.append(1)
		else:
			a.append(0)
			b.append(0)
		p = bit
	if not f:
		print(-1)
		continue
	a1 = b1 = 0
	for i in b:
		b1 = b1 * 2 + i
	for i in a:
		a1 = i + a1 * 2
	print(a1, b1)


t = int(input())
for i in range(t):
	n = int(input())
	S = 2 * n
	bn = []
	tmp = n
	while tmp:
		bn.append(tmp % 2)
		tmp //= 2
	bn.reverse()
	a = bn[:]
	b = [0 for _ in range(len(bn))]
	res = 1
	if bn[-1] == 1:
		res = 0
	else:
		for i in range(len(bn) - 1):
			if bn[i] and bn[i - 1]:
				res = 0
				break
			if bn[i]:
				a[i + 1] = 1
				b[i + 1] = 1
	if not res:
		print(-1)
	else:
		rA = 0
		rB = 0
		POW = 1
		for i in range(len(bn) - 1, -1, -1):
			rA += a[i] * POW
			rB += b[i] * POW
			POW *= 2
		print(rA, rB)


t = int(input())
for i in range(0, t):
	m = int(input())
	x = m
	l = []
	ll = []
	while m >= 1:
		l.append(m % 2)
		m = m // 2
	for j in range(1, len(l)):
		ll.append(l[j])
	ll.append(0)
	l
	ll
	a = 0
	b = 0
	bl = True
	for k in range(0, len(l)):
		if l[k] == 1 and ll[k] == 1:
			bl = False
			break
		elif l[k] == 0 and ll[k] == 1:
			a = a + pow(2, k) * 1
			b = b + pow(2, k) * 1
		elif l[k] == 1 and ll[k] == 0:
			a = a + pow(2, k) * 1
	if x % 2 == 0:
		if bl:
			print(a, b)
		else:
			print(-1)
	else:
		print(-1)


import math
from collections import Counter

def recur(x, s, c=0):
	if x == s == 0:
		return (0, 0)
	if x & 1 ^ s & 1 != c:
		return (None, None)
	if x & 1 != 1 or c != 1:
		(a, b) = recur(x >> 1, s >> 1, 0)
		if a != None:
			return (a << 1, (b << 1) + (x & 1))
	if x & 1 != 1 or c != 0:
		(a, b) = recur(x >> 1, s >> 1, 1)
		if a != None:
			return ((a << 1) + 1, (b << 1) + (x & 1 ^ 1))
	return (None, None)
for t in range(int(input())):
	x = int(input())
	s = 2 * x
	(a, b) = recur(x, s)
	if a == None:
		print(-1)
	else:
		assert a ^ b == x and a + b == s
		print(a, b)


n = int(input())
for i in range(n):
	x = int(input())
	if x % 2 == 1:
		k = (x + 1) // 2
	else:
		k = x // 2
	a = [0] * 33
	b = [0] * 33
	w = [0] * 33
	wk = [0] * 33
	for j in range(33):
		if x >> j & 1:
			w[j] = 1
		if k >> j & 1:
			wk[j] = 1
	flag = False
	for j in range(33):
		if wk[j] == 1 and w[j] == 1:
			flag = True
			break
		elif w[j] == 1:
			a[j] = 1
		elif wk[j] == 1:
			a[j] = 1
			b[j] = 1
	if flag == True:
		print(-1)
		continue
	else:
		resa = 0
		resb = 0
		a.reverse()
		b.reverse()
		for j in range(33):
			resa = resa * 2 + a[j]
			resb = resb * 2 + b[j]
		print(resa, resb)


t = int(input())
for test in range(t):
	x = int(input())
	su = x * 2
	x1 = '0' + bin(x)[2:]
	su1 = bin(su)[2:]
	otva = 0
	otvb = 0
	cur = 1
	fl = 1
	ls = 0
	for i in range(len(x1) - 1, -1, -1):
		if int(x1[i]) == abs(int(su1[i]) - ls) == 0:
			if x1[i - 1] == su1[i - 1]:
				ls = 0
			elif su1[i - 1] == 1:
				otva += cur
				otvb += cur
				ls = 1
			else:
				otva += cur
				otvb += cur
				ls = 1
		elif int(x1[i]) == abs(int(su1[i]) - ls) == 1:
			otva += cur
		else:
			fl = -1
			break
		cur *= 2
	if fl == -1:
		print(-1)
	else:
		print(otva, otvb)


for _ in range(int(input())):
	n = int(input())
	if n % 2:
		print(-1)
		continue
	arr = []
	while n:
		arr.append(n % 2)
		n //= 2
	arr = arr[::-1]
	n = len(arr)
	yes = 1
	for i in range(n - 1):
		if arr[i] == 1 and arr[i + 1] == 1:
			yes = 0
			print(-1)
			break
	if yes == 0:
		continue
	(a, b) = ([0 for i in range(n)], [0 for i in range(n)])
	for i in range(n - 1):
		if arr[i] == 1:
			a[i] = 1
			a[i + 1] = 1
			b[i + 1] = 1
	(a, b) = (a[::-1], b[::-1])
	(a1, b1) = (0, 0)
	for i in range(n):
		a1 += a[i] * 2 ** i
		b1 += b[i] * 2 ** i
	print(str(a1) + ' ' + str(b1))


def generator(x, y):
	s = bin(x)[2:]
	carry = 0
	for i in range(len(s) - 1, -1, -1):
		j = len(s) - 1 - i
		(k1, k2) = (x & 1 << j, y & 1 << j)
		carry += k1 ^ k2
	v1 = v2 = 0
	for i in range(len(s) - 1, -1, -1):
		j = len(s) - 1 - i
		if s[i] == '0':
			if i >= 1:
				_j = len(s) - i
				if carry & 1 << _j:
					v1 += 1 << j
					v2 += 1 << j
		else:
			v1 += 1 << j
	if (v1 + v2) // 2 != x:
		return (-1, -1)
	return (v1, v2)

def main():
	t = int(input())
	for _ in range(t):
		x = int(input())
		(a, b) = generator(x, 2 * x)
		if a == -1:
			(a, b) = generator(x, 2 * x + 1)
			if a == -1:
				print(-1)
			else:
				print('{} {}'.format(a, b))
		else:
			print('{} {}'.format(a, b))
main()