#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0; i<n; i++)
#define FOR1(i,n) for(int i=1; i<=n; i++)
#define E cout << '\n'
#if !ONLINE_JUDGE
#define DB(a,n) for(int loop_iii=0; loop_iii<n; loop_iii++) { cout << a[loop_iii] << ' '; } cout << '\n'
#else
#define DB(a,n)
#endif
typedef long long ll;
typedef pair<int ,int> pii;
typedef pair<ll, ll> pll;
#define xx first
#define yy second
typedef tuple<int, int, int> int3;
#define g0(x) get<0>(x)
#define g1(x) get<1>(x)
#define g2(x) get<2>(x)
#define g3(x) get<3>(x)
#define g4(x) get<4>(x)
//const int MOD = 998244353;
//const int MOD = 1000000007;
const int DMAX = 200000;
//int a[DMAX];
//int b[DMAX];
//int c[DMAX];
//int d[DMAX];
int main() {
#if !ONLINE_JUDGE && 1
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif
#if !ONLINE_JUDGE
auto start = std::chrono::high_resolution_clock::now();
#endif
#if ONLINE_JUDGE
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
#endif
//unordered_map<int, int> mii;
int set_count = 1;
cin >> set_count;
for(int set_number=0; set_number<set_count; set_number++) {
//memset(arr, 0, sizeof(int)*DMAX);
string a, b; cin >> a >> b;
int n = a.length();
bool isok = false;
int i = 0;
while (i<n-1) {
if ((a[i]==b[i]) && (a[i]=='0')) {
if ((a[i+1]==b[i+1]) && (a[i+1]=='1')) {
isok = true;
break;
}
}
i++;
}
cout << (isok ? "YES\n" : "NO\n");
//FOR(i,n) cin >> a[i];
;;
}
#if !ONLINE_JUDGE
auto stop = std::chrono::high_resolution_clock::now();
std::cout << '\n' << std::chrono::duration_cast<std::chrono::milliseconds>(stop-start).count() << " milliseconds\n";
#endif
return 0;
}
1618A - Polycarp and Sums of Subsequences | 1618B - Missing Bigram |
938. Range Sum of BST | 147. Insertion Sort List |
310. Minimum Height Trees | 2110. Number of Smooth Descent Periods of a Stock |
2109. Adding Spaces to a String | 2108. Find First Palindromic String in the Array |
394. Decode String | 902. Numbers At Most N Given Digit Set |
221. Maximal Square | 1200. Minimum Absolute Difference |
1619B - Squares and Cubes | 1619A - Square String |
1629B - GCD Arrays | 1629A - Download More RAM |
1629C - Meximum Array | 1629D - Peculiar Movie Preferences |
1629E - Grid Xor | 1629F1 - Game on Sum (Easy Version) |
2148. Count Elements With Strictly Smaller and Greater Elements | 2149. Rearrange Array Elements by Sign |
2150. Find All Lonely Numbers in the Array | 2151. Maximum Good People Based on Statements |
2144. Minimum Cost of Buying Candies With Discount | Non empty subsets |
1630A - And Matching | 1630B - Range and Partition |
1630C - Paint the Middle | 1630D - Flipping Range |