Fox Ciel is going to take a path to meether friends. The path is tiled with 1x1 square tiles. It is N tiles long and 2tiles wide. If we imagine that the path is going from the left to the right, wecan view it as a rectangle with 2 rows and N columns of tiles. The rows of thepath are numbered 0 to 1 from top to bottom, and the columns of the path arenumbered 0 to N-1 from left to right. Ciel starts at the tile in row 0, column0. She has to reach the tile in row 0, column N-1.In each step, Ciel can moveto an adjacent tile. Two tiles are adjacent if they share at least one point (aside or a corner).Because it rained yesterday, some tiles are covered bypuddles of water. Ciel will not step on these tiles. Each character is 'W' if thetile is covered by water, and '.' otherwise.
#P1751. FoxCiel
FoxCiel
Input
The constraints guarantee that the starting tile and the destination tile are never covered by water.
T indicates T(1<T<100) cases,The path is N tiles long.(1<N<500)
T indicates T(1<T<100) cases,The path is N tiles long.(1<N<500)
Output
Print "YES" if she can move to her destination without entering a tile which is filled with water. Otherwise, Print "NO".
Sample Input
2
8
....W...
W.......
2
..
..
Sample Output
</p>YES
YES