#P7818. Function
Function
Function
Problem Description
Given a sequence of length , is a set generated by :
- , initially.
- If and , add to . Note that here denotes the bitwise exclusive or, i.e. , . If you knew little about that, please refer to https://en.wikipedia.org/wiki/Exclusive. Construct a mapping that satisfies all the following conditions:
- If satisfying , then , satisfying .
- If satisfying , then .
- $\forall x,y \in S(a), \ f(x\oplus y)=f(x) \oplus f(y)$. This problem contains two modes, specified by a parameter . The first mode: The parameter , it means that you are a contestant and you need to construct a solution, which will be checked by on the evaluation machine. Firstly, print if there doesn't exist a mapping function on satisfying the above conditions and go on next test case( but you should also read some following extra data and do not print anything, see input ), otherwise print representing that you have a solution. To check whether your solution is correct, then you are given an integer denoting the number of queries you should answer. For -th query, read a nonnegative integer , print if or if . If there exists a solution satisfying , your solution will be assumed to be correct, otherwise it is wrong. The second mode: The parameter , it means that you are the evaluation machine and you need to check a solution. Firstly, read a string , or denoting whether the evaluation machine assumes that there is a solution. If the conclusion is wrong, print and go on next test case(\textbf{but maybe you should also read some following extra data and do not print anything, see input}). Otherwise, if , you should check whether the construction is correct. You are given an integer and pieces of information. For one of them, you should read a nonnegative integer , and is either a nonnegative integer or according to whether the evaluation machine assumes that . means that it assumes that . And you should also check that is correct or not. Namely, you have to note that if the given , but , it is a wrong construction. Note that the solution given by the evaluation machine may be not generated randomly. If there exists a solution satisfying , you should print denoting that the solution is correct, otherwise it is wrong and you should print . That is to say, the criterion is the same for the two modes. See the example for details.
Input
The first line contains one integer , . For each test case: The first line contains one integer , . The second line contains integers , . Then you should read a string . If , next line contains one integer . The -th of the next lines contains one integer , . If , then next line contains a string , or . If , the next line contains one integer . Each of the next lines contains integers and , . The total of does not exceed . The total of does not exceed .
Output
For each test case: If , print if you have a solution and for each , output a line containing , or print with no extra output if you assumes that there doesn't exist a solution. If , output a line containing if it is correct, otherwise print .
Sample Input
4
4
1 1 2 3
check
HaveSolution
4
1 0
2 1
3 1
4 -1
1
1
construct
1
1
3
1 2 3
check
HaveSolution
2
1 0
4 1
3
1 2 3
construct
2
1
4
Sample Output
Yes
NoSolution
No
HaveSolution
3
-1
Source
2020 Multi-University Training Contest 5