You are given a binary string
of length .
Let be a complete directed graph of vertices numbered from to . There is a directed edge going from vertex to if one of the following is true:
- and
- and
For example, if then looks like this:
You will be given queries of two different types:
- - Flip all the bits in in range and update accordingly.
- - Find whether there is a path that starts from vertex and visits each vertex in exactly once (a hamiltonian path in other words).
is the subgraph induced by the vertices in the range and the edges connecting them. For example, if then consists of the vertices , , and , and the three edges , , and .
Input Format
- The first line contains two integers, and .
- The second line contains a binary string of length .
- The line of the next lines contains the description of the query.
Output Format
For each query of type , print a single line containing YES
if there's a hamiltonian path starting from vertex , or NO
otherwise.
You may print each character of the string in uppercase or lowercase (for example, the strings yEs
, yes
, Yes
and YES
will all be treated as identical).
Constraints
- For queries of type ,
- For queries of type ,
Subtasks
- Subtask #1 (100 points): original constraints
Sample Input 1
5 7
11011
2 1 5 3
2 3 5 3
2 3 5 4
1 4 5
2 1 5 2
1 2 3
2 3 5 4
Sample Output 1
YES
NO
YES
NO
YES
Explanation
Here's what initially looks like:
- First query: is a possible hamiltonian path.
- Second query: There's no hamiltonian path that visits the vertices , , and which starts from .
- Third query: is a possible hamiltonian path.
- Fourth query: Flip the bits in the range so becomes equal to .
- Fifth query: There's no hamiltonian path that visits the vertices , , , , and which starts from .
- Sixth query: Flip the bits in the range so becomes equal to .
- Seventh query: is a possible hamiltonian path.
ConversionConversion EmoticonEmoticon