VOLLEYBALL

 

Program

BALL.C, BALL.CPP, BALL.PAS

The volleyball association of United Hedonia is looking for a new score counting system.
Four different score counting systems are proposed. Three of them are based on the principle "best out of five set wins", that is, the team first gathering three sets wins the whole game. Hence a game ends with the scoring 3-0, 3-1 or 3-2 to either of the two teams. The fourth system is slightly. The major difference between the four alternatives is how the sets are played.

The following describes the four different alternatives:

System 1: Each set is played to 15. In order to win one point the team must serve. If the opponent had the serve the team only wins the serve. One set has to be won with at least 2 points difference, but with sudden death at 17. So it is possible to win by 17-16. If the scoring is 2-2 in sets, a fifth set is played with slightly modified rules. Then it is a point for each ball, independently who had the serve. First team, which reaches 15 points, wins. There must still be a difference of at least 2 points, but with no upper limit.

System 2: Every set is played to 25 points, with scoring for each ball. If a fifth set is played it is only played to 15. A set has to be won with a difference of at least 2 points.

System 3: Each set is played to 50 points. The team gets 2 points if it wins the ball when it is serving, and only one point if the opponent had the serve. A set can be finished 50-49, but the 50th point has to be won by the team who has the serve. A possible 51st point is never received.

System 4: The first and second sets are split into games. Each set is played by two games to 21; points are given for each ball. The team winning both games wins the set. If both teams won one game each a tiebreak with first to 7 is played. If it stands 1-1 in sets, a judging set is played (without games) to 21. A game, tiebreak or judging set must be won by at least 2 points.


In order to really be able to compare the four different systems a tournament was held last summer where different games were played with different scoring system entirely randomly. The Volleyball association of United Hedoina received the correct game results from the tournament. But the organizers have forgotten to tell which game was played with which system. Write a program to clarify the situation.

Input / Output Specification

The first row tells the number of games in the tournament (N<100). Thereafter the N games follows, one game per row.
In each row points received in each set/game are given in the form:

BLA-BLE 15-3 14-16 15-10 15-8


The team names consists always of three uppercase letters from the English alphabet, and between each set / game result there is exactly one blank.

The output should consist of N rows, one for each game with the number of system used. If there are several possible options, all alternatives are written (in increasing order) with exactly one blank between each integer.

Sample input
5

FRC-BRC 15-3 14-16 15-12 15-7

SOL-BOL 25-7 25-23 25-20

BRA-BLA 21-23 23-21 7-5 21-9 21-18

FRC-BOL 15-3 14-16 15-10 15-8

SLE-SLA 25-23 25-23 23-25 23-25 21-19


Sample output
1

2

4

1

2 4