Question
Binary String Transformation
In a tech-savvy college, Alex was caught dozing off during a critical coding lecture by his professor. To keep him on his toes, the professor challenged him with an intriguing problem: Given two binary strings, A and B, both of the same length N, Alex can perform a series of operations to transform string A into string B. The operations involve selecting a prime number, X, and reversing any substring of A that has a length of X. The question is: Can Alex make string A identical to string B using any number of these operations? Can you help Alex crack this problem?
Input
The first line of input will contain a single integer T, denoting the number of test cases.
Each test case consists of multiple lines of input.
The first line of each test case contains an integer N - the length of the strings A and B.
The second line contains the binary string A.
The third line contains the binary string B.
Constraints
1 ≤ T ≤ 102
1 ≤ N ≤ 105
Ai, Bi contains only 0 and 1.
The sum of N over all test cases won't exceed 105.
Each test case consists of multiple lines of input.
The first line of each test case contains an integer N - the length of the strings A and B.
The second line contains the binary string A.
The third line contains the binary string B.
Constraints
1 ≤ T ≤ 102
1 ≤ N ≤ 105
Ai, Bi contains only 0 and 1.
The sum of N over all test cases won't exceed 105.
Output
For each test case, output on a new line, "YES", if you can make the string A equal to B using any number of operations and "NO" otherwise (without quotes).
Example
Sample Input
2
2
10
00
4
1001
0011
Sample Output
NO
YES
Explanation
Test case 1: A can't be made equal to B at any cost.
Test case 2: Take X = 3 and reverse substring of A[1, 3] = 001, so after that A becomes 0011 hence equal to B.
2
2
10
00
4
1001
0011
Sample Output
NO
YES
Explanation
Test case 1: A can't be made equal to B at any cost.
Test case 2: Take X = 3 and reverse substring of A[1, 3] = 001, so after that A becomes 0011 hence equal to B.