#P1604B. XOR Specia-LIS-t
XOR Specia-LIS-t
Description
YouKn0wWho has an integer sequence . Now he will split the sequence into one or more consecutive subarrays so that each element of belongs to exactly one subarray. Let be the number of resulting subarrays, and be the lengths of the longest increasing subsequences of corresponding subarrays.
For example, if we split into , , , then .
YouKn0wWho wonders if it is possible to split the sequence in such a way that the bitwise XOR of is equal to . You have to tell whether it is possible.
The longest increasing subsequence (LIS) of a sequence is the longest sequence of valid indices such that and . For example, the LIS of is , which has length .
An array is a subarray of an array if can be obtained from by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line of each test case contains integers ().
It is guaranteed that the sum of over all test cases doesn't exceed .
For each test case, print "YES" (without quotes) if it is possible to split into subarrays in the desired way, print "NO" (without quotes) otherwise. You can print each letter in any register (upper or lower).
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line of each test case contains integers ().
It is guaranteed that the sum of over all test cases doesn't exceed .
Output
For each test case, print "YES" (without quotes) if it is possible to split into subarrays in the desired way, print "NO" (without quotes) otherwise. You can print each letter in any register (upper or lower).
Note
In the first test case, YouKn0wWho can split the sequence in the following way: , , . This way, the LIS lengths are , and the bitwise XOR of the LIS lengths is .
In the second test case, it can be shown that it is impossible to split the sequence into subarrays that will satisfy the condition.