Bits and Pieces

Let A and B be non-negative integers and let C=A&BandD=A|B. GivenCandD, can you find A and B such that the absolute difference (|A − B|) is minimal? (A&B and A|B are bitwise AND and OR respectively). Input The input starts with an integer T — the num- ber of test cases (T ≤ 100). T cases follow on each subsequent line, each of them containing integers C and D (0 ≤ C,D < 231). Output For each test case, print integers A and B on a line such that A&B = C, A|B = D, A ≤ B and B − A is minimal. If there are no such A and B, print ‘-1’ on the line instead. Sample Input 3 23 32 3 15 Sample Output 23 -1 7 11