#agc031c. [agc031_c]Differ by 1 Bit
[agc031_c]Differ by 1 Bit
Problem Statement
You are given integers and . Determine if there exists a permutation of that satisfies all of the following conditions, and create one such permutation if it exists.
- For all , the binary representations of and differ by exactly one bit.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If there is no permutation that satisfies the conditions, print NO
.
If there is such a permutation, print YES
in the first line. Then, print in the second line, with spaces in between. If there are multiple solutions, any of them is accepted.
Sample Input 1
2 1 3
Sample Output 1
YES
1 0 2 3
The binary representation of is , where any two adjacent elements differ by exactly one bit.
Sample Input 2
3 2 1
Sample Output 2
NO