Monocarp is playing a computer game. Now he wants to complete the first level of this game.

A level is a rectangular grid of 2 rows and n columns. Monocarp controls a character, which starts in cell (1, 1) — at the intersection of the 1-st row and the 1-st column.

Monocarp's character can move from one cell to another in one step if the cells are adjacent by side and/or corner. Formally, it is possible to move from cell (x_1, y_1) to cell (x_2, y_2) in one step if |x_1 - x_2| ≤ 1 and |y_1 - y_2| ≤ 1. Obviously, it is prohibited to go outside the grid.

There are traps in some cells. If Monocarp's character finds himself in such a cell, he dies, and the game ends.

To complete a level, Monocarp's character should reach cell (2, n) — at the intersection of row 2 and column n.

Help Monocarp determine if it is possible to complete the level.

Input

The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases. Then the test cases follow. Each test case consists of three lines.

The first line contains a single integer n (3 ≤ n ≤ 100) — the number of columns.

The next two lines describe the level. The i-th of these lines describes the i-th line of the level — the line consists of the characters '0' and '1'. The character '0' corresponds to a safe cell, the character '1' corresponds to a trap cell.

Additional constraint on the input: cells (1, 1) and (2, n) are safe.

Output

For each test case, output YES if it is possible to complete the level, and NO otherwise.

Example

Input


4
3
000
000
4
0011
1100
4
0111
1110
6
010101
101010


Output


YES
YES
NO
YES

Note

Consider the example from the statement.

In the first test case, one of the possible paths is (1, 1) → (2, 2) → (2, 3).

In the second test case, one of the possible paths is (1, 1) → (1, 2) → (2, 3) → (2, 4).

In the fourth test case, one of the possible paths is (1, 1) → (2, 2) → (1, 3) → (2, 4) → (1, 5) → (2, 6).
1
9
000000010
000000000
 1
9
000000010
000100000
 1
60
000000000000000000000000000000000000000000000000000000000010
000000000000000000000000000000000000000000000000000000000010

YES
 YES
 NO

import javax.swing.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.nio.file.attribute.FileAttribute;
import java.util.*;
import java.io.*;
//a+b = (a^b) + 2*(a&b)
//b^c = (a^b)^(a^c)
//gcd(x,y) = gcd(x-y,y)
// bit value at ith position changes in interval of 2^i
// Do not define variables by a weird name
// always use   (p*1LL >> q)
// prefer 'int' than 'long long'
// gcd(Fn,Fm) = Fgcd(n,m)  // Property of Fibonacci
// lets prime factorization of n=(p1^e1)*(p2^e2) //total factors will be (e1+1)*(e2+1)
// and some of factors would be (1+p1+p1^2 + .. p1^e1)*(1+p2+p2^2+...+p2^e2)
// nC(r) + nC(r+1) = (n+1)C(r+1) => pascal's formula
public class Main {

    static long gcd(long a, long b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }

    static class TrieNode {
        TrieNode childern[] = new TrieNode[26];
        int count = 0;
        boolean isEnd = false;

        TrieNode() {
            for (int i = 0; i < childern.length; ++i) childern[i] = null;
        }
    }

    //----------------------


    static int max(int tree[], int index, int left, int right, int l, int r, int max) {

        if (left >= right) {
            return 0;
        }
        if (right < l || r < left) {
            return 0;
        }

        System.out.println(index + " " + left + " " + right);

        int mid = (left + right) / 2;
        int first = max(tree, 2 * index + 1, left, mid, l, r, max);
        int second = max(tree, 2 * index + 2, mid + 1, right, l, r, max);
        return Math.max(first, second);

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(
                    new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static int mod = 1000000007;

    static long mul(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static long add(long a, long b) {
        return (a % mod + b % mod) % mod;
    }

    static long factorial(int n) {
        long ans = 1;
        for (int i = 1; i <= n; ++i) {
            ans = (ans % mod * i % mod) % mod;
        }
        return ans;
    }

    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    static long power(long x, long y, int p) {
        long res = 1;
        x = x % p;

        while (y > 0) {


            if (y % 2 == 1)
                res = (res * x) % p;

            y = y >> 1;
            x = (x * x) % p;
        }

        return res;
    }


    static long modInverse(long n, int p) {
        return power(n, p - 2, p);
    }

    static long nCrModPFermat(int n, int r,
                              int p) {

        if (n < r) {
            return 0;
        } else if (r == 0) {
            return 1;
        }


        long[] fac = new long[n + 1];
        fac[0] = 1;

        for (int i = 1; i <= n; i++)
            fac[i] = fac[i - 1] * i % p;

        return (fac[n] * modInverse(fac[r], p)
                % p * modInverse(fac[n - r], p)
                % p)
                % p;
    }

    static void print(int arr[]) {
        for (int elements : arr) System.out.print(elements + " ");
    }

    static boolean union(int x, int y, int parent[]) {
        int root1 = find(x, parent);
        int root2 = find(y, parent);
        if (root1 == root2) {
            return false;
        }
        parent[root1] = root2;
        return true;
    }

    static int find(int x, int parent[]) {
        if (x == parent[x]) {
            return x;
        }
        return parent[x] = find(parent[x], parent);  //path compression
    }

    static int dp[] = new int[1000006];

    static void count() {
        int dp[] = new int[1000006];
        Arrays.fill(dp, -1);
        int count = 0;
        for (int i = 2; i < dp.length; ++i) {
            if (dp[i] == -1) {
                for (int j = i; j < dp.length; j += i) {
                    dp[j] = 1;
                    Main.dp[j]++;
                }
            }
        }

    }

    static class Pair  implements  Comparable<Pair>{
        int a;
        int b;
        int c;int d;


        Pair(int a, int b,int c,int d) {
            this.a = a;
            this.b = b;
            this.c=c;
            this.d=d;


        }

        @Override
        public int compareTo(Pair o) {
          if(this.a==o.a){
              return this.b-o.b;
          }
          else{
              return this.a-o.a;
          }

        }
    }

 static int upperbound(int arr[],int element){
        if(element<0){
            return -1;
        }
        int start=0;
        int end=arr.length-1;
        int answer=-1;
        while(start<=end){
            int mid=((start+end))>>1;
            //System.out.println(mid);
            if(arr[mid]<element){
                start=mid+1;
            }

            else{
                answer=mid;
                end=mid-1;
            }

        }
        return answer;
 }
 static int lowerBound(int arr[],int element){
      int start=0;
      int end=arr.length-1;
      int answer=-1;
      while(start<=end){
          int mid=(start+end)>>1;
          if(arr[mid]>element){
              answer=mid;
              end=mid-1;
          }
          else{
              start=mid+1;
          }
      }
      return answer;
 }
    static long arr[] = new long[1000001];

    static void fill() {
        Arrays.fill(arr, -1);
        boolean bl[] = new boolean[1000001];
        for (int i = 2; i * i <= arr.length; ++i) {
            if (arr[i] == -1) {
                for (int j = i * i; j < arr.length; j += i) {
                    arr[j] = 1;

                }
            }
        }

    }

static int search(int arr[],int element){
        int start=0;
        int end=arr.length-1;
        int answer=arr.length;
        while(start<=end){
            int mid=(start+end)/2;
            if(arr[mid]>element){
                answer=mid;
                end=mid-1;
            }
            else{
                start=mid+1;
            }

        }
        return answer;
}
static boolean check(int dp[][],int x,int y,boolean bl[][],int dd[][]){
        if(x>=dp.length||x<0||y<0||y>=dp[0].length||dp[x][y]==1||bl[x][y]==true){
            return false;
        }
        if(dd[x][y]==1){
            return true;
        }
        if(x==dp.length-1&&y==dp[0].length-1){
            return true;
        }
       bl[x][y]=true;
        boolean first=check(dp,x+1,y,bl,dd);
        boolean second=check(dp,x,y+1,bl,dd);
        boolean third=check(dp,x+1,y+1,bl,dd);
        boolean fourd=check(dp,x-1,y+1,bl,dd);
        bl[x][y]=false;
        if( first|second|third|fourd==true){
            dd[x][y]=1;
            return true;
        }
        return false;


}

    public static void main(String[] args) {
FastReader scan=new FastReader();
int t=scan.nextInt();
while(t-->0){
    int n=scan.nextInt();
    int dp[][]=new int[2][n];
    for(int i=0;i<dp.length;++i){
        String m=scan.next();
        for(int j=0;j<dp[0].length;++j){
            dp[i][j]=m.charAt(j)-'0';
        }
    }
    int dp1[][]=new int[2][n];
    if(dp[0][0]==1){
        System.out.println("NO");
        continue;
    }
    else{
        int check=0;
      for(int i=0;i<dp.length;++i){
          if(dp[0][i]==dp[1][i]&&dp[0][i]==1){
              check=1;
              break;
          }
      }
      if(check==1){
          System.out.println("NO");

      }
      else{
          System.out.println("YES");
      }

    }

}







    }
}





