Problem D: Only one choice?[Medium]

## Problem D: Only one choice?[Medium]

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 176  Solved: 124
[Submit][Status][Web Board]

## Description

Hong wants to sort a given permutation by swapping two adjacent elements.  It's easy for Hong to do that with minimum operations.

Hong find that for some permutation, the solution is unique.  Hong thinks that these permutation is good.

However, Hong is not good at maths.  He asks you to judge whether the solution for the given permutation is unqiue.

Solution means the sequence of elements we choose in each operation.

## Input

The first line will be an integer T (1≤T≤10), which is the number of test cases.

For each test data:

The first line contains one integer N (1N≤10^5) — the number of the integers.

The next line contains N integers, a permutation of 1,2,...,N.

## Output

For each case, if there is a unique solution for this case, output one character 'Y'. Otherwise, output 'N'.

## Sample Input

3
1
1
3
3 2 1
4
3 1 2 4


## Sample Output

Y
N
Y


[Submit][Status]