CF1984A.Strange Splitting

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Strange Splitting

Define the range of a non-empty array to be the maximum value minus the minimum value. For example, the range of [1,4,2][1,4,2] is 41=34-1=3.

You are given an array a1,a2,,ana_1, a_2, \ldots, a_n of length n3n \geq 3. It is guaranteed aa is sorted.

You have to color each element of aa red or blue so that:

  • the range of the red elements does not equal the range of the blue elements, and
  • there is at least one element of each color.

If there does not exist any such coloring, you should report it. If there are multiple valid colorings, you can print any of them.

Input

The first line contains a single integer tt (1t1001 \leq t \leq 100) — the number of test cases.

The first line of each test case contains an integer nn (3n503 \leq n \leq 50) — the length of the array.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1091 \leq a_i \leq 10^9). It is guaranteed a1a2an1ana_1 \leq a_2 \leq \ldots \leq a_{n - 1} \leq a_{n}.

Output

For each test case, if it is impossible to color aa to satisfy all the constraints, output NO.

Otherwise, first output YES.

Then, output a string ss of length nn. For 1in1 \leq i \leq n, if you color aia_i red, sis_i should be R. For 1in1 \leq i \leq n, if you color aia_i blue, sis_i should be B.

Note

In the first test case, given the array [1,1,2,2][1, 1, 2, 2], we can color the second element blue and the remaining elements red; then the range of the red elements [1,2,2][1, 2, 2] is 21=12-1=1, and the range of the blue elements [1][1] is 11=01-1=0.

In the second test case, we can color the first, second, fourth and fifth elements [1,2,4,5][1, 2, 4, 5] blue and the remaining elements [3][3] red.

The range of the red elements is 33=03 - 3 = 0 and the range of the blue elements is 51=45 - 1 = 4, which are different.

In the third test case, it can be shown there is no way to color a=[3,3,3]a = [3, 3, 3] to satisfy the constraints.

Samples

7
4
1 1 2 2
5
1 2 3 4 5
3
3 3 3
4
1 2 2 2
3
1 2 2
3
1 1 2
3
1 9 84
YES
RBRR
YES
BBRBB
NO
YES
RBBR
YES
RRB
YES
BRR
YES
BRB

在线编程 IDE

建议全屏模式获得最佳体验