#P1604B. XOR Specia-LIS-t

XOR Specia-LIS-t

Description

YouKn0wWho has an integer sequence a1,a2,ana_1, a_2, \ldots a_n. Now he will split the sequence aa into one or more consecutive subarrays so that each element of aa belongs to exactly one subarray. Let kk be the number of resulting subarrays, and h1,h2,,hkh_1, h_2, \ldots, h_k be the lengths of the longest increasing subsequences of corresponding subarrays.

For example, if we split [2,5,3,1,4,3,2,2,5,1][2, 5, 3, 1, 4, 3, 2, 2, 5, 1] into [2,5,3,1,4][2, 5, 3, 1, 4], [3,2,2,5][3, 2, 2, 5], [1][1], then h=[3,2,1]h = [3, 2, 1].

YouKn0wWho wonders if it is possible to split the sequence aa in such a way that the bitwise XOR of h1,h2,,hkh_1, h_2, \ldots, h_k is equal to 00. You have to tell whether it is possible.

The longest increasing subsequence (LIS) of a sequence b1,b2,,bmb_1, b_2, \ldots, b_m is the longest sequence of valid indices i1,i2,,iki_1, i_2, \ldots, i_k such that i1<i2<<iki_1 \lt i_2 \lt \ldots \lt i_k and bi1<bi2<<bikb_{i_1} \lt b_{i_2} \lt \ldots \lt b_{i_k}. For example, the LIS of [2,5,3,3,5][2, 5, 3, 3, 5] is [2,3,5][2, 3, 5], which has length 33.

An array cc is a subarray of an array bb if cc can be obtained from bb 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 tt (1t100001 \le t \le 10\,000)  — the number of test cases.

The first line of each test case contains a single integer nn (2n1052 \le n \le 10^5).

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1091 \le a_i \le 10^9).

It is guaranteed that the sum of nn over all test cases doesn't exceed 31053 \cdot 10^5.

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 tt (1t100001 \le t \le 10\,000)  — the number of test cases.

The first line of each test case contains a single integer nn (2n1052 \le n \le 10^5).

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1091 \le a_i \le 10^9).

It is guaranteed that the sum of nn over all test cases doesn't exceed 31053 \cdot 10^5.

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).

Sample Input 1

4
7
1 3 4 2 2 1 5
3
1 3 4
5
1 3 2 4 2
4
4 3 2 1

Sample Output 1

YES
NO
YES
YES

Note

In the first test case, YouKn0wWho can split the sequence in the following way: [1,3,4][1, 3, 4], [2,2][2, 2], [1,5][1, 5]. This way, the LIS lengths are h=[3,1,2]h = [3, 1, 2], and the bitwise XOR of the LIS lengths is 312=03 \oplus 1 \oplus 2 = 0.

In the second test case, it can be shown that it is impossible to split the sequence into subarrays that will satisfy the condition.