| RUCP x WiCS Mini-Contest |
|---|
| Finished |
Templates for this problem are available here.
Bob has an $$$n \times n$$$ grid of squares. Each square can be colored either red or blue. Bob is a fair person. He calls a grid "good" if every square is adjacent to exactly $$$2$$$ squares of the same color. Two squares are considered adjacent if they share a side.
Given an integer $$$n$$$, output a good coloring of an $$$n \times n$$$ grid or state that no good coloring exists.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows.
Each test case consists of a single integer $$$n$$$ ($$$1 \le n \le 1000$$$) — the size of the grid.
It is guaranteed that the sum of $$$n^2$$$ over all test cases does not exceed $$$10^6$$$.
For each test case, print YES if there is a solution, and NO otherwise. You may print every letter in any case you want (so, for example, the strings "yEs", "yes", "Yes", and "YES" will all be recognized as positive answers).
If you printed YES, print $$$n$$$ additional lines. The $$$i$$$-th of these should contain $$$n$$$ characters R or B, indicating the colors of the squares in the $$$i$$$-th row of the grid in your coloring.
If there are multiple solutions, you may print any.
223
YESBBBBNO
In the first test case, every square is adjacent to two squares of the same color. For example, $$$(1, 1)$$$ is adjacent to $$$(1, 2)$$$ and $$$(2, 1)$$$, and all of those squares are blue.
It can be shown that there is no good coloring of a $$$3 \times 3$$$ grid.
| Name |
|---|


