#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ll q;
  cin >> q;
  for (ll i = 0; i < q; i++) {
    ll n;
    cin >> n;
    vector<string> in(2);
    cin >> in[0] >> in[1];
    bool ok = true;
    ll p = 0;
    for (ll i = 0; i < n; i++) {
      if (in[p][i] >= '3') {
        p ^= 1;
        ok &= in[p][i] >= '3';
      }
    }
    ok &= p == 1;
    cout << (ok ? "YES" : "NO") << endl;
  }
}
