#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e10;
const long long mod = 1e9 + 7;
void faster() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const long long M = 100 + 10;
const long long N = 200 * 1000 + 10;
char grid[N][2];
long long dp[N][2];
int dx[2] = {1, 0};
int dy[2] = {0, 1};
int cx[4] = {-1, 1, 1, -1};
int cy[4] = {1, 1, -1, -1};
int n;
bool ans = false;
int main() {
  faster();
  int q;
  cin >> q;
  while (q--) {
    cin >> n;
    int cnt = 0;
    bool ans = 0;
    for (int j = 0; j < 2; j++) {
      for (int i = 0; i < n; i++) {
        cin >> grid[i][j];
      }
    }
    int x = 0, y = 0;
    while (1) {
      if (grid[x][y] < '3') {
        x++;
      } else {
        y = 1 - y;
        if (grid[x][y] < '3') {
          ans = false;
          break;
        } else {
          x++;
        }
      }
      if (x == n && y == 1) {
        ans = true;
        break;
      }
    }
    if (ans)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
