#K68722. Check if All Strings Can Form a Palindrome

    ID: 32928 Type: Default 1000ms 256MiB

Check if All Strings Can Form a Palindrome

Check if All Strings Can Form a Palindrome

You are given T test cases. In each test case, you are given N strings. For each test case, determine if every string can be rearranged to form a palindrome.

A string can be rearranged into a palindrome if and only if the number of characters with odd frequency is at most one. In other words, for a string \( s \) to be rearranged into a palindrome, it must satisfy:

[ \text{oddCount}(s) \leq 1 ]

For each test case, print YES if every string satisfies this condition, or NO otherwise.

inputFormat

The first line contains an integer T denoting the number of test cases.

Each test case begins with an integer N which denotes the number of strings. The next N lines each contain a string. All input is provided via standard input (stdin).

outputFormat

For each test case, output a single line containing YES if every string in the test case can be rearranged to form a palindrome, otherwise print NO. The output should be printed to standard output (stdout).

## sample
2
3
civic
ivicc
hello
2
racecar
level
NO

YES

</p>