#P1168E. Xor Permutations
Xor Permutations
No submission language available for this problem.
Description
Toad Mikhail has an array of integers .
Find two permutations and of integers , such that is equal to for all possible , or determine there are no such permutations. Here denotes the bitwise XOR operation.
The first line contains one integer (), denoting that the size of the array is .
The next line contains space-separated integers () — the elements of the given array.
If the given array can't be represented as element-wise XOR of two permutations of integers , print "Fou".
Otherwise, print "Shi" in the first line.
The next two lines should contain the description of two suitable permutations. The first of these lines should contain space-separated distinct integers , and the second line should contain space-separated distinct integers .
All elements of and should be between and , inclusive; should be equal to for all such that . If there are several possible solutions, you can print any.
Input
The first line contains one integer (), denoting that the size of the array is .
The next line contains space-separated integers () — the elements of the given array.
Output
If the given array can't be represented as element-wise XOR of two permutations of integers , print "Fou".
Otherwise, print "Shi" in the first line.
The next two lines should contain the description of two suitable permutations. The first of these lines should contain space-separated distinct integers , and the second line should contain space-separated distinct integers .
All elements of and should be between and , inclusive; should be equal to for all such that . If there are several possible solutions, you can print any.