Today, Sherlock Holmes is playing with numbers. He has got 4 numbers A, B, C, and S from a crime scene. He is trying to find those 2 numbers which ORing gives C. If those numbers are M and N (M|N=C where | denotes bitwise OR), these must be found only to interchange at max S bits of A and B. If there are multiple solutions, make M as small as possible; if there are still multiple solutions, make N as small as possible.
Holmes need your help to find M and N. So write a program to help Holmes.
The first line of the input contains an integer T denoting the number of test cases. The description of each test case follows.
Print two lines of output for each test case:
If no valid answer exists, you must instead print one line of output with the integer -1.
1<T <6
0 < S< 5x105
0< A,B,C< 165x10000
3
8
2B
9F
58
5
B9
40
5A
2
91
BE
A8
8
58
18
42
-1
A = (2B)16 = (00101011)2
After changing 3 bits
M = (00001000)2 = (8)16
B = (9F)16 = (10011111)2
After changing 5 bits
N = (01011000)2 = (58)16
M|N = (8)16 | (58)16 = (58)16 = C