#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int q;
  cin >> q;
  int ans[q];
  for (int i = 0; i < q; i++) {
    int n;
    cin >> n;
    int flow[n];
    string s1, s2;
    cin >> s1 >> s2;
    int j = 1;
    char c = '0';
    if (s1[0] - c < 3) {
      flow[0] = 1;
      if (n == 1) ans[i] = 0;
    } else {
      if (s2[0] - c < 3) {
        ans[i] = 0;
        j = n;
      } else {
        flow[0] = 2;
        if (n == 1) ans[i] = 1;
      }
    }
    for (; j < n - 1; j++) {
      if (flow[j - 1] == 1) {
        if (s1[j] - c < 3)
          flow[j] = 1;
        else {
          if (s2[j] - c < 3) {
            ans[i] = 0;
            j = n;
          } else {
            flow[j] = 2;
          }
        }
      } else {
        if (s2[j] - c < 3)
          flow[j] = 2;
        else {
          if (s1[j] - c < 3) {
            ans[i] = 0;
            j = n;
          } else {
            flow[j] = 1;
          }
        }
      }
    }
    if (j == n - 1) {
      if (flow[n - 2] == 1) {
        if (s1[n - 1] - c < 3)
          ans[i] = 0;
        else {
          if (s2[n - 1] - c < 3)
            ans[i] = 0;
          else
            ans[i] = 1;
        }
      } else {
        if (s2[n - 1] - c < 3)
          ans[i] = 1;
        else
          ans[i] = 0;
      }
    }
  }
  for (int i = 0; i < q; i++) {
    if (ans[i] == 0) {
      cout << "NO"
           << "\n";
    } else
      cout << "YES"
           << "\n";
  }
}
