beecrowd | 1875

# Tribol

By Ricardo Martins, IFSULDEMINAS 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.

• The match a time of thirty minutes.
• The team that scores a goal in the opponent's the same counterclockwise, is a normal goal.
• The team that scores a goal in the clockwise opponent the same, worth double.
• If the three teams make the same amount of goals, there is a trempate
• If the two teams who make more goals have made the same amount, there is a tie (empate), and the game is decided by penalties.
• The team that makes the most goals, wins.

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

• The Green team makes a goal in the Blue team and a goal in the Red team, totaling three goals;
• The Blue team is two goals in the Green team, totaling 2 goals;
• The Red team makes two goals in Green team, totaling four goals and winning the match.

## 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