UOJ Logo 黑暗爆炸OJ

DARKBZOJ

#3497. Pa2009 Circular Game

Statistics 下载数据

Description

一个大小为m的轮盘,上面有a个白棋子,b个黑棋子。
白棋先行,每次可以走到一个中间没有任何棋子的位
。例如下图中,8号棋子可以走到1、7、9-个位置。

哪方先不能移动就输。问哪方能赢,或者判断游戏永远
  无法结束。
 1 < =M<= 1000000000,1<=a+b<= 1000000。

Input

The first line of the standard input contains one integer t representing the number of boards to be considered. The following lines contain descriptions of respective boards, each of which consists of three lines. In the first line there are three integers m, b and c (1<=M<=10^9,1<=b,c) separated by single spaces and denoting the length of the board, the number of white pieces and the number of black pieces. In the second line there is an increasing sequence of b integers (in the range 1……m) representing the positions of white pieces. In the third line there is an increasing sequence of integers (in the range 1……m) representing the positions of black pieces. The total number of pieces in all boards does not exceed 10^6.

Output

Exactly lines with answers for consecutive boards should be written to the standard output. The answer is always a single character: B, C, or R, depending on whether the white player wins (B), the black player wins (C) or the game never ends (R).

Sample Input

3
9 2 3
3 8
2 5 6
6 2 2
5 6
2 4
7 1 1
3
4

Sample Output

C
B
R

Hint

Source