P22390 [CodeChef] MAKEPALAGAIN
普及-
题目描述

Chef has a string A (containing lowercase Latin letters only) of length N where N is even. He can perform the following operation any number of times:
Swap A_{i} and A_{i + 2} for any 1 ≤ i ≤ (N - 2)

Determine if Chef can convert string A to a palindromic string.

Note: A string is called a palindrome if it reads the same backwards and forwards. For example$, \texttt{noon}$ and $\texttt{level}$ are palindromic strings but $\texttt{ebb}$ is not.

------ Input Format ------

  • The first line contains a single integer T — the number of test cases. Then the test cases follow.
  • The first line of each test case contains an integer N — the length of the string A.
  • The second line of each test case contains a string A of length N containing lowercase Latin letters only.

------ Output Format ------

For each test case, output YES if Chef can convert the string A to a palindromic string. Otherwise, output NO.

You may print each character of YES and NO in either uppercase or lowercase (for example, yes, yEs, Yes will be considered identical).

------ Constraints ------

$1 ≤ T ≤ 200$
$1 ≤ N ≤ 1000$
$S$ contains lowercase Latin letters only.
$N$ is even

----- Sample Input 1 ------
3
6
aabbaa
4
abcd
6
zzxyyx

----- Sample Output 1 ------
YES
NO
YES

----- explanation 1 ------
Test case $1$: The given string is already a palindrome.

Test case $2$: It can be proven that is it not possible to convert $A$ to a palindromic string.

Test case $3$: We can perform the following operations:
- Swap $A_{1}$ and $A_{3}$. (Now $A$ becomes xzzyyx)
- Swap $A_{2}$ and $A_{4}$. (Now $A$ becomes xyzzyx)

输入格式

见题面

输出格式

见题面

样例输入
3 6 aabbaa 4 abcd 6 zzxyyx
样例输出
YES NO YES