The Third Three Number Problem solution codeforces-

The Third Three Number Problem solution codeforces-

Solution – CLICK HERE

You are given a positive integer n. Your task is to find any three integers ab and c (0,,1090≤a,b,c≤109) for which ()+()+()=(a⊕b)+(b⊕c)+(a⊕c)=n, or determine that there are no such integers.

Here a⊕b denotes the bitwise XOR of a and b. For example, 24=62⊕4=6 and 31=23⊕1=2.

Input

The Third Three Number Problem solution codeforces

Each test contains multiple test cases. The first line contains a single integer t (11041≤t≤104) — the number of test cases. The following lines contain the descriptions of the test cases.

The only line of each test case contains a single integer n (11091≤n≤109).

Output

For each test case, print any three integers ab and c (0,,1090≤a,b,c≤109) for which ()+()+()=(a⊕b)+(b⊕c)+(a⊕c)=n. If no such integers exist, print 1−1.

Example

input

Copy

The Third Three Number Problem solution codeforces

5
4
1
12
2046
194723326

output

Copy

The Third Three Number Problem solution codeforces

3 3 1
-1
2 4 6
69 420 666
12345678 87654321 100000000
Note

In the first test case, =3a=3=3b=3=1c=1, so (33)+(31)+(31)=0+2+2=4(3⊕3)+(3⊕1)+(3⊕1)=0+2+2=4.

In the second test case, there are no solutions.

In the third test case, (24)+(46)+(26)=6+2+4=12(2⊕4)+(4⊕6)+(2⊕6)=6+2+4=12.

Solution – CLICK HERE

Leave a Comment