You want to create a grid with $$$\le 500$$$ rows and $$$\le 500$$$ columns, and then color each cell of the grid either red or blue.
Let's say your grid contains $$$n$$$ rows numbered $$$1, 2, \ldots n$$$ from top to bottom and $$$m$$$ columns numbered $$$1, 2, \ldots m$$$ from left to right. Let $$$(i, j)$$$ denote the cell with row number $$$i$$$ and column number $$$j$$$.
Consider a path from top left to bottom right $$$$$$(x_1 = 1, y_1 = 1), (x_2, y_2), \ldots (x_{n+m - 2}, y_{n+m - 2}), (x_{n + m - 1} = n, y_{n + m - 1} = m),$$$$$$ that goes either right or down, that is, for every $$$1 \lt i \le n + m - 1$$$, either $$$(x_i, y_i) = (x_{i-1}, y_{i-1} + 1)$$$ or $$$(x_i, y_i) = (x_{i-1}+1, y_{i-1})$$$. We call such a path almost red if at max $$$1$$$ of the $$$n + m - 1$$$ cells on the path is colored blue. Similarly, we such a path almost blue if at max one of the $$$n + m - 1$$$ cells on the path is colored red.
Your task is to construct a grid and its coloring such that:
Constraints:
For each testcase, first print the number of rows and the number of columns, $$$n$$$ and $$$m$$$ on a new line. Then, print $$$n$$$ lines. The $$$i-$$$th line should contain a string describing the $$$i-$$$th row of the grid. The $$$j-$$$th character of this string should be R if the cell $$$(i, j)$$$ is colored red and B otherwise.
2 1 1 0 5
2 2 RB RB 3 4 BBBR RBRR BBBB
In the output of the first testcase, there are two paths, the first being almost red and the second being almost blue:
In the output of the second testcase, there are no almost red paths. There are $$$5$$$ almost blue paths as required: