##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
3 1 5 2 1 3 2 7 7
Yes Yes 3 1 No
2 4 3 5 3 7 3 1 2 3
Yes 3 7 5 4 3 1 No
You are given an array of positive integers.
In one operation, you choose any two elements and from the array, remove both of them, and insert the value (bitwise XOR) into the array.
You will perform exactly operations, so the array becomes a single number.
Determine whether it is possible to choose the operations in such a way that the value is never produced at any moment, i.e. after every operation the inserted value must be non-zero.
For each test case, if it is impossible, print No.
Otherwise, print Yes, and then print lines. The -th line should contain two integers and — the values of the two elements you choose in the -th operation. Both and must be present in the current array, and must hold (which guarantees ).
After each operation, both and are removed from the array, and the value is inserted.
If there are multiple valid answers, you may print any of them.
In the first test case, , so no operations are needed and the answer is Yes.
In the second test case, the array is . We choose and : since , this is valid. The array becomes .
In the third test case, the array is . The only possible operation is to choose both s, but , which is forbidden. So the answer is No.
In the first test case, the array is . The total XOR is , and the elements are not all equal, so a valid sequence exists.
One valid sequence of operations:
In the second test case, the array is . The total XOR is . Since XOR is preserved across operations, the final element must be , which is forbidden. So the answer is No.