This afternoon, you decided to enjoy the first days of Spring by taking a walk outside. As you come near the Quidditch field, you hear screams. Once again, there is a conflict about the score: the two teams are convinced that they won the game! To prevent this problem from happening one more time, you decide to get involved in the refereeing of the matches.
Now, you will stay in the stadium to watch the game and count the score. At the end of the game, you will decide the winner.
Today, two teams are competing: the red Gryffindor (R) and the blue Ravenclaw (B) team. Each team is composed of \(P\) players (\(1 \leq P \leq 10\)).
The field is a rectangle of \(N\) lines and \(M\) columns (\(3 \leq N, M \leq 99\), \(N\) and \(M\) are odd). All the positions are integers, and several entities are allowed to be at the same position in the field. At the beginning of the game, the field contains goals for the two teams (each team can own between one and five goals), the players, and exactly one Quaffle. In this version of the problem, one Bludger can be present. An other type of ball will be available in the harder version of the problem.
A game is composed of \(T\) steps (\(0 \leq T \leq 10000\)). At each step, one entity on the field (a player or a ball) performs one action. All entities can move. A player can also catch a ball or throw the Quaffle that it is carrying. To catch a ball, a player must be located on the same cell as it. The Quaffle does not perform any action while it is being carried; it only follows the movements of the player. If a player carrying the Quaffle decides to throw it, the Quaffle is simply put at the current position of the player. If a player is on the same cell as a Bludger (either after a movement from the player or the Bludger), the player is eliminated. If the player is eliminated while it is carrying the Quaffle, the Quaffle remains on the cell containing both the player and the Bludger after the move. It is guaranteed that this never occurs while the player is in a cell containing a goal.
To win a point, a player must leave the Quaffle at a goal of the other team. When it does, the team of the player wins one point, and the Quaffle instantly moves to the middle of the field (the cell at the \((M+1)/2\)-th column of the \((N+1)/2\)-th line of the field, starting from 1). There is no goal in the middle of the field. If a player puts the ball in its own goal, the other team wins the point.
Output
You must output the description of the main events of the game, one event per line. More precisely:
- Each time a team scores, you must print t RED GOAL or t BLUE GOAL, depending on the team who scored, where t is the current time (the position of the action in the list of actions, starting from 0). In the case where a player scores in the wrong goal (a red player scores in the red goal, or a blue player scores in the blue goal), you must print the name of the team who wins one point, that is, the other team.
- Each time a player is eliminated, you must print t p ELIMINATED, where t is the current time and p is the player who is eliminated. The format to print the player is the same as in the input.
The events must be printed in ascending order of t. If several players are eliminated at the same time, the events must be written in alphabetical order: B0, ..., B9, R0, ... R9.
At the end of the game, you must print the final score as: FINAL SCORE: r b, where r is the score of the red team and b is the score of the blue team.
Note
In the first example, the red player takes the Quaffle, move it and throw it. The blue player catches the ball, goes to the red goal and scores.
In the second example, the red player takes the ball and scores in the goal of their own team: the blue team wins a point.
In the third example, the Bludger goes at the position of R0: R0 is eliminated. Then, B0 moves to the position of the Bludger: B0 is eliminated too.
You can find one more example in the easy version of the problem
Примеры
| № | Входные данные | Выходные данные |
|
1
|
3 5 .. .. R0 .. .. RG .. .Q .. BG .. .. B0 .. .. 12 R0 D R0 C .Q R0 R R0 T R0 D B0 R B0 U B0 C .Q B0 L B0 L B0 L B0 T
|
11 BLUE GOAL
FINAL SCORE: 0 1
|
|
2
|
3 5 .. .. R0 .. .. RG .. .Q .. BG .. .. B0 .. .. 5 R0 D R0 C .Q R0 L R0 L R0 T
|
4 BLUE GOAL
FINAL SCORE: 0 1
|
|
3
|
5 5 .. .. .. .. .. .. .. .. .. .. RG R0 .Q B0 BG .. .. .. .. .. .. .. .B .. .. 5 .B L .B U .B U B0 L B0 L
|
2 R0 ELIMINATED
4 B0 ELIMINATED
FINAL SCORE: 0 0
|