Codeforces LATOKEN Round 1 (Div. 1 + Div. 2)
A
Colour the Flag
Codeforces
800
原题
←B →
翻译中…

Today we will be playing a red and white colouring game (no, this is not the Russian Civil War; these are just the colours of the Canadian flag).

翻译中…

You are given an $n \times m$ grid of "R", "W", and "." characters. "R" is red, "W" is white and "." is blank. The neighbours of a cell are those that share an edge with it (those that only share a corner do not count).

翻译中…

Your job is to colour the blank cells red or white so that every red cell only has white neighbours (and no red ones) and every white cell only has red neighbours (and no white ones). You are not allowed to recolour already coloured cells.

翻译中…

Input

翻译中…

The first line contains $t$ ($1 \le t \le 100$), the number of test cases.

翻译中…

In each test case, the first line will contain $n$ ($1 \le n \le 50$) and $m$ ($1 \le m \le 50$), the height and width of the grid respectively.

翻译中…

The next $n$ lines will contain the grid. Each character of the grid is either 'R', 'W', or '.'.

翻译中…

Output

翻译中…

For each test case, output "YES" if there is a valid grid or "NO" if there is not.

翻译中…

If there is, output the grid on the next $n$ lines. If there are multiple answers, print any.

翻译中…

In the output, the "YES"s and "NO"s are case-insensitive, meaning that outputs such as "yEs" and "nO" are valid. However, the grid is case-sensitive.

翻译中…

Note

翻译中…

The answer for the first example case is given in the example output, and it can be proven that no grid exists that satisfies the requirements of the second example case. In the third example all cells are initially coloured, and the colouring is valid.

翻译中…

样例

Input #1
3
4 6
.R....
......
......
.W....
4 4
.R.W
....
....
....
5 1
R
W
R
W
R
Output #1
YES
WRWRWR
RWRWRW
WRWRWR
RWRWRW
NO
YES
R
W
R
W
R
InputCopy OutputCopy
题目信息
题号
1534A
时间限制
1.5 s
内存限制
256 MB
标签
暴力
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。