#P11020. [2016杭电多校]Life Winner Bo
[2016杭电多校]Life Winner Bo
Life Winner Bo
Problem Description
Bo is a "Life Winner".He likes playing chessboard games with his girlfriend G. The size of the chessboard is .The top left corner is numbered and the lower right corner is numberd . For each game,Bo and G take turns moving a chesspiece(Bo first).At first,the chesspiece is located at .And the winner is the person who first moves the chesspiece to .At one point,if the chess can't be moved and it isn't located at ,they end in a draw. In general,the chesspiece can only be moved right or down.Formally,suppose it is located at ,it can be moved to the next point only if and .Also it can't be moved to the outside of chessboard. Besides,There are four kinds of chess(They have movement rules respectively). 1.king. 2.rook(castle). 3.knight. 4.queen. (The movement rule is as same as the chess.) For each type of chess,you should find out that who will win the game if they both play in an optimal strategy. Print the winner's name("B" or "G") or "D" if nobody wins the game.
Input
In the first line,there is a number as a case number. In the next lines,there are three numbers type, and . "type" means the kind of the chess.
Output
For each question,print the answer.
Sample Input
4
1 5 5
2 5 5
3 5 5
4 5 5
Sample Output
G
G
D
B
Author
绍兴一中
Source
2016 Multi-University Training Contest 3