Question
Palindromic Scrolls Challenge

In a distant land, a sorceress named Maya possesses two ancient scrolls.

  • The first scroll contains a string called X of length N, and
  • the second scroll holds a string called Y of length M.
Maya has the power to rearrange the letters of both scrolls as she pleases. Her challenge is to rearrange these two strings into X’ and Y’, then combine them in such a way that the final magical scroll (X’ + Y’) reads the same forwards and backwards, creating a powerful palindrome.
Can you help Maya discover if this mystical palindrome is possible or not?
Input
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 two integers N and M - the length of the strings A and B respectively.
The second line of each test case contains a string A of length N containing lowercase Latin letters only.
The third line of each test case contains a string B of length M containing lowercase Latin letters only.

Constraints
1 ≤ T ≤ 105
1 ≤ N, M ≤ 105
A and B consist of lowercase Latin letters only.
Note: Sum of N + M over all test cases does not exceed 2x105.
Output
For each test case, output Yes if we can rearrange A and B such that (A′ + B′) becomes a palindrome. Otherwise, output No.

Example
Sample Input
2
5 2
abcdd
ac
3 3
abc
xyz
Sample Output
Yes
No
Explanation
Test case 1: We can rearrange A to A' = acdbd and B to B' = ca. so A' + B' = acdbdca which is palindromic.
Test case 2: We can not rearrange A and B such that A' + B′ is palindromic.

Online