Pa2009 Circular Game

时间限制:10s    【提交】    空间限制:128MB

题目描述

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

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


输入格式

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.


输出格式

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).


样例输入

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

样例输出

C
B
R

提示

没有写明提示


题目来源

没有写明来源