406569: GYM102441 K Chess Positions

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Chess Positionstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You have an unlimited number of white and black chess pieces such as the queen, bishop, knight and rook. You are also given two numbers, $$$w$$$ and $$$b$$$, the number of white and black pieces that must be under attack. It is required to create a position on the board 8$$$\times$$$8 suitable for the restrictions described above.

The queen, the bishop and the rook move in the allowed direction before another figure is met and can attack if it is of a different color. The Knight also attacks a figure of a different color and and can jump over other pieces.

Input

First line contains integer $$$t$$$ — number of tests. Next $$$t$$$ lines contain two integers $$$w$$$ and $$$b$$$ each — number of white and black chess pieces under attack, correspondingly. $$$$$$ 1 \le t \le 10^3 $$$$$$ $$$$$$ 0 \le w, b \le 50$$$$$$ $$$$$$ w + b \le 64 $$$$$$

Output

For each test, you are required to output a chess position which satisfies given conditions. The position should be represented by 8 lines containing 8 symbols each. The positions should be split by an empty line. Empty cells should be printed as '.', cells containing queen should be represented as 'q', bishop cells – 'b', knight cells – 'k', and rook cells – 'r'. White pieces should be printed in upper case and black ones in lower case. If there are multiple correct positions, you may print any of them. It is guaranteed that the correct answer always exists.

ExampleInput
2
2 3
4 2
Output
Q.b...rR
....K...
........
.....b..
........
..k.....
.k......
......Q.

........
Q.k...Q.
........
...k....
..r..B..
....BkK.
.....K..
..K.K...

Note

加入题单

上一题 下一题 算法标签: