#P1633. 二进制
二进制
Description
There are three integers , where denotes the binary representation of (without leading 0s).
Let be the maximum length among . You need to construct three positive integers that satisfy the following conditions:
- The lengths of do not exceed .
- The number of 1s in equals that in .
- The number of 1s in equals that in .
- The number of 1s in equals that in .
- .
Input Format
The first line contains a positive integer , indicating there are test cases.
The next lines each contain three positive integers .
Output Format
Output lines, one answer per line.
Output the minimal . If there is no valid , output .
4
7 6 9
1 1 1
1 1 4
3 3 9
10
-1
2
6
Hint
Constraints and Notes
- For 30% of the testdata, .
- For 100% of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号