You are given a permutation of length .
In one operation, you may choose an index such that and
then swap and .
Determine whether it is possible, after performing any number of operations, to make hold for every .
For each test case, output Yes if the required permutation can be obtained, and No otherwise.
The answer is case-insensitive. For example, YES, yes, and yEs are all accepted.
Choose . Since , swap the elements at indices and . The sequence becomes , which satisfies the required condition.
Choose and swap indices and . The sequence becomes .
Next, choose and swap indices and . The sequence becomes .
Finally, choose and swap indices and . The sequence becomes , which satisfies the required condition.
Swap the elements at indices , then , then , and finally . These operations produce a permutation satisfying the required condition.