You are given a permutation of length .
On this permutation, we can perform the following operation multiple times:
- Select an index such that ;
- Reverse the subarray .
Is it possible to sort the permutation?
A permutation of length is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array), and is also not a permutation ( but there is in the array).
Input
Each test contains multiple testcases. The first line of each testcase contains an integer () — the number of testcases.
The first line of each testcase contains one integer () — the length of permutation .
The second line of each testcase contains integers (, all are pairwise distinct) — the elements of permutation .
It is guaranteed that the sum of across all testcases does not exceed .
Output
For each testcase, print YES
if can be sorted, or NO
otherwise.
Example
stdin
6
1
1
2
2 1
3
3 2 1
4
4 3 2 1
5
1 3 2 5 4
5
3 4 5 2 1
stdout
YES
NO
YES
NO
NO
YES
Note
In the first two testcases, no operations can be performed since . is already sorted, while is not.
In the third testcase, the permutation can be sorted by choosing and reversing .
In the fourth and fifth testcases, it can be proven that cannot be sorted.