description: 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).
solution: import java.io.OutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.PrintWriter;
  import java.util.InputMismatchException;
  import java.io.IOException;
  import java.io.InputStream;
  
  /**
   * Built using CHelper plug-in
   * Actual solution is at the top
   *
   * @author dauom
   */
  public class Main {
    public static void main(String[] args) {
      InputStream inputStream = System.in;
      OutputStream outputStream = System.out;
      InputReader in = new InputReader(inputStream);
      PrintWriter out = new PrintWriter(outputStream);
      AComputerGame solver = new AComputerGame();
      int testCount = Integer.parseInt(in.next());
      for (int i = 1; i <= testCount; i++)
        solver.solve(i, in, out);
      out.close();
    }
  
    static class AComputerGame {
      public final void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        char[][] g = in.nextCharMatrix(2, n);
        boolean[][] r = new boolean[2][n];
        r[1][n - 1] = true;
        r[0][n - 1] = g[0][n - 1] == '0';
        for (int i = n - 2; i >= 0; i--) {
          for (int j = 0; j < 2; j++) {
            if (g[j][i] == '0') {
              if (r[j][i + 1] || r[(j + 1) % 2][i + 1]) {
                r[j][i] = true;
              }
            }
          }
        }
        out.println(r[0][0] ? "YES" : "NO");
      }
  
    }
  
    static final class InputReader {
      private final InputStream stream;
      private final byte[] buf = new byte[1 << 18];
      private int curChar;
      private int numChars;
  
      public InputReader() {
        this.stream = System.in;
      }
  
      public InputReader(final InputStream stream) {
        this.stream = stream;
      }
  
      private int read() {
        if (this.numChars == -1) {
          throw new UnknownError();
        } else {
          if (this.curChar >= this.numChars) {
            this.curChar = 0;
  
            try {
              this.numChars = this.stream.read(this.buf);
            } catch (IOException ex) {
              throw new InputMismatchException();
            }
  
            if (this.numChars <= 0) {
              return -1;
            }
          }
  
          return this.buf[this.curChar++];
        }
      }
  
      public final int nextInt() {
        int c;
        for (c = this.read(); isSpaceChar(c); c = this.read()) {
        }
  
        byte sgn = 1;
        if (c == 45) { // 45 == '-'
          sgn = -1;
          c = this.read();
        }
  
        int res = 0;
  
        while (c >= 48 && c <= 57) { // 48 == '0', 57 == '9'
          res *= 10;
          res += c - 48; // 48 == '0'
          c = this.read();
          if (isSpaceChar(c)) {
            return res * sgn;
          }
        }
  
        throw new InputMismatchException();
      }
  
      public final String next() {
        int c;
        while (isSpaceChar(c = this.read())) {
        }
  
        StringBuilder result = new StringBuilder();
        result.appendCodePoint(c);
  
        while (!isSpaceChar(c = this.read())) {
          result.appendCodePoint(c);
        }
  
        return result.toString();
      }
  
      private static boolean isSpaceChar(final int c) {
        return c == 32 || c == 10 || c == 13 || c == 9
            || c == -1; // 32 == ' ', 10 == '\n', 13 == '\r', 9 == '\t'
      }
  
      public final char[] nextCharArray() {
        return next().toCharArray();
      }
  
      public final char[][] nextCharMatrix(final int n, final int m) {
        char[][] res = new char[n][m];
        for (int i = 0; i < n; ++i) {
          res[i] = nextCharArray();
        }
        return res;
      }
  
    }
  }
  
  