For each case with piece size X and board R by C, decide whether Richard has an X-omino that blocks every tiling or Gabriel tiles the board anyway.
Medium6Game theoryGeometryMathNo attempts yetTime limit5sMemory limit512 MBAn N-omino is a flat shape made of N unit squares joined edge to edge. A 1-omino is a single 1×1 square. An N-omino is an (N-1)-omino with one more 1×1 square attached along an edge. Two N-ominoes count as the same shape when one can be rotated or flipped onto the other.
The five possible 4-ominoes are shown below.

Some of the 108 7-ominoes are shown below.

Richard and Gabriel play the following game for fixed X, R and C.
Gabriel wins if he fills the board under these rules, and Richard wins if Gabriel cannot. Given X, R and C, decide which player wins.
The first line contains the number of test cases T.
Each of the next T lines contains X, R and C, separated by spaces.
1≤T≤100, 1≤X,R,C≤20
For each test case, print one line in the form Case #x: y. Here x is the test case number starting from 1. If at least one X-omino guarantees a win for Richard, y is RICHARD. If no such X-omino exists, y is GABRIEL.
In test case 1 of the sample, the only 2-omino Richard can choose is the 1×2 rectangle. Two of those rectangles always fill a 2×2 board, so Gabriel wins.
In test case 2 the only choice is again the 1×2 rectangle. Wherever Gabriel puts it on a 1×3 board, one cell is left over, so Richard wins.
In test case 3 Richard chooses the 4-omino shaped like a 2×2 square. It has nowhere to go on a 1×4 board, so Richard wins.
In test case 4 Richard can choose the straight 1×3 tromino or the L shaped tromino. In both cases Gabriel fills the 2×3 board with two copies of the same shape, so Gabriel wins.