Three permutations of length are given. Each permutation contains every integer from to exactly once.
A permutation of length is called good if it satisfies the following condition.
- For every pair of distinct integers , if appears before in , then also appears before in at least two of .
There are queries. Each query swaps two adjacent elements in one of the three permutations. The changes made by previous queries remain in effect.
Immediately after each query, determine whether a good permutation exists for the current .
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
In the -th query, if swap the -th and -th elements of ; if , do the same in ; if , do the same in .
Output
For each query of each test case, print YES if a good permutation exists immediately after the query, and print NO otherwise. Print one answer per line.
Constraints
- .
- .
- .
- Each of is a permutation of .
- ().
- ().
- The sum of over all test cases does not exceed .
- The sum of over all test cases does not exceed .