#P1766C. Hamiltonian Wall

Hamiltonian Wall

Description

Sir Monocarp Hamilton is planning to paint his wall. The wall can be represented as a grid, consisting of 22 rows and mm columns. Initially, the wall is completely white.

Monocarp wants to paint a black picture on the wall. In particular, he wants cell (i,j)(i, j) (the jj-th cell in the ii-th row) to be colored black, if ci,j=c_{i, j} = 'B', and to be left white, if ci,j=c_{i, j} = 'W'. Additionally, he wants each column to have at least one black cell, so, for each jj, the following constraint is satisfied: c1,jc_{1, j}, c2,jc_{2, j} or both of them will be equal to 'B'.

In order for the picture to turn out smooth, Monocarp wants to place down a paint brush in some cell (x1,y1)(x_1, y_1) and move it along the path (x1,y1),(x2,y2),,(xk,yk)(x_1, y_1), (x_2, y_2), \dots, (x_k, y_k) so that:

  • for each ii, (xi,yi)(x_i, y_i) and (xi+1,yi+1)(x_{i+1}, y_{i+1}) share a common side;
  • all black cells appear in the path exactly once;
  • white cells don't appear in the path.

Determine if Monocarp can paint the wall.

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of testcases.

The first line of each testcase contains a single integer mm (1m21051 \le m \le 2 \cdot 10^5) — the number of columns in the wall.

The ii-th of the next two lines contains a string cic_i, consisting of mm characters, where each character is either 'B' or 'W'. ci,jc_{i, j} is 'B', if the cell (i,j)(i, j) should be colored black, and 'W', if the cell (i,j)(i, j) should be left white.

Additionally, for each jj, the following constraint is satisfied: c1,jc_{1, j}, c2,jc_{2, j} or both of them are equal to 'B'.

The sum of mm over all testcases doesn't exceed 21052 \cdot 10^5.

For each testcase, print "YES" if Monocarp can paint a wall. Otherwise, print "NO".

Input

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of testcases.

The first line of each testcase contains a single integer mm (1m21051 \le m \le 2 \cdot 10^5) — the number of columns in the wall.

The ii-th of the next two lines contains a string cic_i, consisting of mm characters, where each character is either 'B' or 'W'. ci,jc_{i, j} is 'B', if the cell (i,j)(i, j) should be colored black, and 'W', if the cell (i,j)(i, j) should be left white.

Additionally, for each jj, the following constraint is satisfied: c1,jc_{1, j}, c2,jc_{2, j} or both of them are equal to 'B'.

The sum of mm over all testcases doesn't exceed 21052 \cdot 10^5.

Output

For each testcase, print "YES" if Monocarp can paint a wall. Otherwise, print "NO".

Sample Input 1

6
3
WBB
BBW
1
B
B
5
BWBWB
BBBBB
2
BW
WB
5
BBBBW
BWBBB
6
BWBBWB
BBBBBB

Sample Output 1

YES
YES
NO
NO
NO
YES

Note

In the first testcase, Monocarp can follow a path (2,1)(2, 1), (2,2)(2, 2), (1,2)(1, 2), (1,3)(1, 3) with his brush. All black cells appear in the path exactly once, no white cells appear in the path.

In the second testcase, Monocarp can follow a path (1,1)(1, 1), (2,1)(2, 1).

In the third testcase:

  • the path (1,1)(1, 1), (2,1)(2, 1), (2,2)(2, 2), (2,3)(2, 3), (1,3)(1, 3), (2,4)(2, 4), (2,5)(2, 5), (1,5)(1, 5) doesn't suffice because a pair of cells (1,3)(1, 3) and (2,4)(2, 4) doesn't share a common side;
  • the path (1,1)(1, 1), (2,1)(2, 1), (2,2)(2, 2), (2,3)(2, 3), (1,3)(1, 3), (2,3)(2, 3), (2,4)(2, 4), (2,5)(2, 5), (1,5)(1, 5) doesn't suffice because cell (2,3)(2, 3) is visited twice;
  • the path (1,1)(1, 1), (2,1)(2, 1), (2,2)(2, 2), (2,3)(2, 3), (2,4)(2, 4), (2,5)(2, 5), (1,5)(1, 5) doesn't suffice because a black cell (1,3)(1, 3) doesn't appear in the path;
  • the path (1,1)(1, 1), (2,1)(2, 1), (2,2)(2, 2), (2,3)(2, 3), (2,4)(2, 4), (2,5)(2, 5), (1,5)(1, 5), (1,4)(1, 4), (1,3)(1, 3) doesn't suffice because a white cell (1,4)(1, 4) appears in the path.