beecrowd | 1875

Tribol

By Ricardo Martins, IFSULDEMINAS BR Brazil

Timelimit: 1

In the city of Triangulândia, the biggest dream of its population was to build a soccer field, but there all land is triangular. If one were to make a rectangular field, a good part of the land would be seized to build the field. Then the Hypo and Tenusa brothers had a great idea: Creating a new game, derived from soccer, but played in a triangular field, and called the Tribol game. The rules were simple:

They play three teams at the same time: Red, Green and Blue.

Example of departure. The teams are arranged in the same field in the image below.

Input

There will be several test cases . The first number being read C is an integer representing the number of test cases. Each test case begins with an integer P , representing the amount of goals in the match . The following will be read P lines , each with two characters M and S , indicating the first letter of the team that scored the goal and the first letter of the team that conceded the goal , respectively.

Output

For each test case, print the result of the game in normal time, based on the goals that have been marked .

Input Sample Output Sample

3

3

G R

R B

B G

5

G B

G R

B R

B G

R G

1

B G

trempate

empate

blue