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

// Author: Srikanth 
// Handle: Srikanth1777
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import static java.lang.Math.min;
import static java.lang.Math.max;
import static java.lang.Math.abs;
public class Main {
	static boolean DEBUG = false;

	public static void main(String[] args) throws IOException {
		Comparator<pair> com = (p1,
				p2) -> ((p1.first > p2.first || (p1.first == p2.first && p1.second > p2.second)) ? 1 : -1);
		if (System.getProperty("ONLINE_JUDGE") == null) {
			System.setIn(new FileInputStream(new File("D://program//javaCPEclipse//MyJava//src//MyJava//input.txt")));
			// System.setOut(new PrintStream(new File("output.txt")));
			System.setErr(new PrintStream(new File("D://program//javaCPEclipse//MyJava//src//MyJava//error.txt")));
			DEBUG = true;
		}
		Reader fs = new Reader();
		PrintWriter pw = new PrintWriter(System.out);
		int t = fs.nextInt();
		while (t-- > 0) {
			int n = fs.nextInt();
			StringBuilder z1 = new StringBuilder(fs.next());
			StringBuilder z2 = new StringBuilder(fs.next());
			boolean ispossible = true;
			for(int i = 1 ; i < n ; i++) {
				if(z1.charAt(i) == '1' && z1.charAt(i - 1) == '1' && z2.charAt(i) == '1' && z2.charAt(i - 1) == '1') {
					ispossible = false;
				}
			}
			if(z2.charAt(n-1) == '1') ispossible = false;
			pw.println(ispossible ? "YES" : "NO");
		}
		fs.close();
		pw.close();

	}

	static void debug(int a[], String l) {
		if (DEBUG) {
			System.err.print("l-> [");
			for (int x : a)
				System.err.print(x + " ");
			System.err.println("]");
		}
	}

	static void debug(long a[], String l) {
		if (DEBUG) {
			System.err.print("l-> [");
			for (long x : a)
				System.err.print(x + " ");
			System.err.println("]");
		}
	}

	static <T> void debug(HashSet<Integer> a, String l) {
		if (DEBUG) {
			System.err.println(l + " -> ");
			System.err.println(a);
		}
	}

	static void debug(String a, String l) {
		if (DEBUG) {
			System.err.println(l + " -> " + a);
		}
	}

	static void debug(StringBuilder a, String l) {
		if (DEBUG) {
			System.err.println(l + " -> " + a);
		}
	}

	static <T extends Number, V extends T> void debug(HashMap<T, V> a, String l) {
		if (DEBUG) {
			System.err.println(l + " -> ");
			System.err.println(a);
		}
	}

	static <T extends Number> void debug(T a, String l) {
		if (DEBUG) {
			System.err.println(l + " -> " + a);
		}
	}

	static <T extends Number> void debug(T[] a, String l) {
		if (DEBUG) {
			System.err.print(l + " -> \n" + "[ ");
			for (int i = 0; i < a.length; i++) {
				System.err.print(a[i] + " ");
			}
			System.err.println("]");
		}
	}

	static <T> void debug(ArrayList<T> a, String l) {
		if (DEBUG) {
			System.err.print(l + " -> ");
			System.err.print("[ ");
			for (T q : a) {
				System.err.print(q + " ");
			}
			System.err.println("]");
		}
	}

	static boolean primeFactors(long n, long b) {
		while (n % 2 == 0) {
			if (b % 2 != 0)
				return false;
			n = n / 2;
		}
		for (long i = 3; i * i <= n; i = i + 2) {
			while (n % i == 0) {
				if (b % i != 0)
					return false;
				n = n / i;
			}
		}
		if (n > 2)
			if (b % n != 0)
				return false;
		return true;
	}

	public static long __gcd(long a, long b) {
		if (b != 0) {
			return __gcd(b, a % b);
		} else {
			return a;
		}
	}

	public static int lower_bound(ArrayList<Integer> ar, int k) {
		int s = 0;
		int e = ar.size();
		while (s != e) {
			int mid = s + e >> 1;
			if (ar.get(mid) < k) {
				s = mid + 1;
			} else {
				e = mid;
			}
		}
		if (s == ar.size()) {
			return -1;
		}
		return s;
	}

	public static int upper_bound(ArrayList<Integer> ar, int k) {
		int s = 0;
		int e = ar.size();
		while (s != e) {
			int mid = s + e >> 1;
			if (ar.get(mid) <= k) {
				s = mid + 1;
			} else {
				e = mid;
			}
		}
		if (s == ar.size()) {
			return -1;
		}
		return s;
	}

	static final int MAXN = (int) 1e7;

	// stores smallest prime factor for every number
	static int spf[] = new int[MAXN];

	// Calculating SPF (Smallest Prime Factor) for every
	// number till MAXN.
	// Time Complexity : O(nloglogn)
	static void sieve() {
		spf[1] = 1;
		for (int i = 2; i < MAXN; i++)

			// marking smallest prime factor for every
			// number to be itself.
			spf[i] = i;

		// separately marking spf for every even
		// number as 2
		for (int i = 4; i < MAXN; i += 2)
			spf[i] = 2;

		for (int i = 3; i * i < MAXN; i++) {
			// checking if i is prime
			if (spf[i] == i) {
				// marking SPF for all numbers divisible by i
				for (int j = i * i; j < MAXN; j += i)

					// marking spf[j] if it is not
					// previously marked
					if (spf[j] == j)
						spf[j] = i;
			}
		}
	}

	// A O(log n) function returning primefactorization
	// by dividing by smallest prime factor at every step
	static ArrayList<Integer> getFactorization(int x) {
		ArrayList<Integer> ret = new ArrayList<>();
		while (x != 1) {
			ret.add(spf[x]);
			x = x / spf[x];
		}
		return ret;
	}

	public static ArrayList<Integer> sieve(int n) {
		int[] prime = new int[n + 1];
		ArrayList<Integer> ans = new ArrayList<Integer>();
		for (int p = 2; p <= n; p++) {
			if (prime[p] == 0) {
				ans.add(p);
				for (int i = p * p; i <= n; i += p) {
					prime[i] = 1;
				}
			}
		}
		return ans;
	}

	static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String next() throws IOException {
			byte[] buf = new byte[100009];
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c <= ' ') {
					if (cnt != 0) {
						break;
					} else {
						continue;
					}
				}
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ') {
				c = read();
			}
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public int[] readArray(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public int[] readArray(int n, int x) throws IOException {
			int[] arr = new int[n + x];
			for (int i = x; i < n + x; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public ArrayList<Integer> readList(int n) throws IOException {
			ArrayList<Integer> a = new ArrayList<Integer>();
			for (int i = 0; i < n; i++) {
				a.add(nextInt());
			}
			return a;
		}

		public int[][] read2Array(int n, int m) throws IOException {
			int[][] a = new int[n][m];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					a[i][j] = nextInt();
				}
			}

			return a;
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}

	public static int pow(int base, int index) {
		if (index == 0) {
			return 1;
		} else if (index % 2 == 0) {
			return pow(base * base, index / 2);
		} else {
			return base * pow(base * base, ((index - 1) / 2));
		}
	}

	public static long pow(long base, long index) {
		if (index == 0) {
			return 1;
		} else if (index % 2 == 0) {
			return pow(base * base, index / 2);
		} else {
			return base * pow(base * base, ((index - 1) / 2));
		}
	}

	static class pair {
		long first;
		long second;

		pair() {
			this.first = 0l;
			this.second = 0l;
		}

		pair(long first, long second) {
			this.first = first;
			this.second = second;
		}

		void make_pair(long first, long second) {
			this.first = first;
			this.second = second;
		}
	}
}