#d2500. 异或和或
异或和或
XOR and OR
Problem Description
You are given a sequence of length .
You may perform the following operation any number of times:
- Choose two indices ().
- Let , , where denotes bitwise XOR and denotes bitwise OR.
- Then set or .
Given two sequences and , determine whether you can turn into by a finite number (possibly zero) of operations.
Input Format
The first line contains an integer , the number of test cases (). Then follow test cases:
For each test case, the first line contains a string (), and the second line contains a string ().
Note: may not be equal to .
Output Format
If can be turned into by a finite number (possibly zero) of operations, output YES; otherwise output NO.
Sample Input
2
001
011
11
101
Sample Output
YES
NO
Sample Explanation
For the first test case, choose ; then , and after setting we obtain the sequence .
For the second test case, and , so the requirement clearly cannot be met.