You are given two binary stringsand . You need to convert into using the following operation any number of times (possibly zero):
- Pick three binary values , , and , such that at least one of them is equal to and at least one of them is equal to . Then, pick three distinct indices , , and , and assign , , and .
Determine whether it’s possible to convertinto .
- The first line contains an integer denoting the number of test cases. The test cases then follow.
- The first line of each test case contains denoting the length of and .
- The second line of each test case contains .
- The third line of each test case contains .
For each test case, output on one line
YES if it is possible to convert to , or
NO if it is not possible to do so. Output is case insensitive.
Sample Input 1
2 4 1001 0101 3 111 000
Sample Output 1
For the first test case, we chooseand . This satisfies the above condition. Three indices are chosen as , and are then assigned as respectively. After this operation, transforms into
For the second test case, no set of any operations is possible to makeequals to .