Fuzzy Graph
题号:NC225348
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
Special Judge, 64bit IO Format: %lld

题目描述

A competition named Fuzzy Logic is held in Yinchuan. It has nothing to do with logic, though. Participants are given an undirected connected graph consisting of  vertices and  edges (no self-loops, multiple edges), requiring them to color each vertex into one of three colors: red, green, and blue. Then, for each edge, if it connects two concolorous vertices, its color becomes theirs, or otherwise, it remains black. The goal is to make the whole graph is still connected by black edges, which means there is always one or more paths of black edges between two distinct vertices.

Toilet-Ares is taking part in the competition. However, as an ambitious participant, merely accomplishing the goal is not what Toilet-Ares expects. Awards are. In order to arouse participants' interests, the sponsor set up a pair of special awards. Call a coloring valid, if and only if it meets the basic goal. Those who made a valid coloring satisfying the extra rule are going to win the corresponding award. 

Each kind of color appears the same number of times in vertices. To make the award available,  is divisible by three.

Exist kind of color appears the most number of times in vertices, without any edge colored in it. There may be multiple kinds that appear most times.

As shown below, if the given graph is the left one, Toilet-Ares may color vertices like the right one. Obviously, it is a valid way since the colored graph is connected by black edges. In addition, all three colors appear two times, and no green edge is found, where green is one of the kinds that appear most times. Thus, Toilet-Ares can win both awards.



Please find out a valid coloring to help Toilet-Ares win award, or determine that it's impossible.

输入描述:

The first line of input contains one integer  . Then  test cases follow. For each:

The first line contains two integers  (, is divisible by three), representing the number of vertices and edges.

Next  lines, the -th of them contains two integers u_i,v_i , representing that the -th edge connects vertices u_i and v_i.

It is guaranteed that the given graph is initially connected without self-loops or multiple edges.

The sum of -s in all test cases is not more than .

The sum of -s in all test cases is not more than .

输出描述:

For each test case, if it's impossible to make a valid coloring or win either award, print  in one line.

Otherwise, print a string of length  in one line. The -th character is either R, G, or B, respectively representing that the vertex  is colored in red, green, or blue. Again, your coloring should be valid and can win at least one award. If there are multiple ways, print any.
示例1

输入

复制
1
6 8
1 2
2 3
4 5
5 6
1 4
2 5
3 6
1 5

输出

复制
RGBGRB