#C5157. Alternating Checkerboard Pattern
Alternating Checkerboard Pattern
Alternating Checkerboard Pattern
You are given a checkerboard with n rows and m columns. Your task is to fill the checkerboard with two characters, 'A' and 'B', such that the board is colored in an alternating pattern. Specifically, for a cell located at row i and column j (0-indexed), the cell is filled with 'A' if \( (i+j) \mod 2 = 0 \) and with 'B' otherwise.
For each test case, you should first output a line containing "YES" to indicate that a solution exists. Then, output the checkerboard configuration line by line.
Example:
Input: 1 2 2</p>Output: YES AB BA
inputFormat
The first line contains an integer T, the number of test cases. Each of the following T lines contains two space-separated integers n and m, which represent the number of rows and columns of the checkerboard respectively.
Example:
2 2 2 3 3
outputFormat
For each test case, output begins with a line containing the word "YES". Then output n lines each containing a string of length m representing the filled checkerboard.
Example:
YES AB BA YES ABA BAB ABA## sample
1
1 1
YES
A
</p>