Sunyoung built a new puzzle that uses identical L-shaped pieces. Each piece is made of three unit squares glued together in an L shape: the single square at the bend (the corner) is black, and the other two are white. In other words, one piece consists of a black square, a white square attached directly above or below it, and a white square attached directly to its left or right. Because a piece may be rotated in steps of 90 degrees, the two white squares can sit in any of four corner orientations relative to the black square: (left, up), (right, up), (left, down), or (right, down).
The goal is to place these L pieces on a grid so that they exactly form a given black-and-white pattern. Pieces may be rotated but may not overlap. Each piece covers exactly one black cell and two white cells; every colored cell of the pattern must be covered by exactly one piece, and every empty cell must be left uncovered.
Given several patterns, write a program that decides for each one whether it can be built from these L pieces. Assume you have an unlimited supply of pieces.
The first line contains the number of test cases $T$. ($1 \le T \le 100$)
Each test case begins with a line containing the pattern's height $n$ and width $m$, separated by a space. ($1 \le n, m \le 500$) Each of the next $n$ lines is a string of length $m$ describing the pattern. Every character is one of 'B' (a black cell), 'W' (a white cell), or '.' (an empty cell). Every pattern contains at least one colored cell (black or white).
For each test case, print YES on its own line if the pattern can be built from the L pieces, or NO otherwise.