Hide

Problem B
Boule Judge

/problems/accenture22.boulejudge/file/statement/en/img-0001.jpg
A round of boule played.
By Arne Nordmann, CC BY-SA 3.0.

Jonna recently retired, and nowadays does nothing but drink coffee and play a game Swedes call boule – and she’s all out of coffee. Boule1 is played by two teams throwing $6$ heavy metal balls called boules as close to a small wooden ball, the jack, as possible. Scoring a round of boule is quite simple. The team with the closest boule to the jack wins round, and receives one point for each boule of theirs that is closer to the jack than the closest boule of the opposing team. If neither team was closest, the round is tied.

For example, consider the boule field in Figure 1, illustrating the first sample case. Jonna’s closest boule at coordinates $(22, 80)$ is $\sqrt{29}$ length units away from the jack. The opponents’ closest boule at $(27, 70)$, is $\sqrt{74}$ length units away, so Jonna’s team won the round. Jonna has an additional boule closer to the jack: her fifth boule at $(12, 75)$ is $\sqrt{64}$ length units away. Since Jonna’s team has two boules closer to the jack than the opponents’ closest boule, her team scores two points.

\includegraphics[width=1\textwidth ]{sample1}
Figure 1: An illustration of the first sample. Jonna’s boules are colored black, and the opponents’ boules are white. The jack is marked in red. A circle is drawn around the jack showing what balls are closer than the opponents’ closest ball.

After losing badly in the last weekend tournament Jonna participated in, she’s become convinced that the judge of the tournament isn’t as impartial as he claims. Many times he ruled that the opposing team had a boule closer to the jack than Jonna’s team, even though this was clearly not the case. Jonna therefore wants a mobile app she can pull up whenever she doubts the judge’s decision to determine the score of a round.

Being a computer vision expert, it was trivial for Jonna to write a program that identifies the positions of the jack and all the boules on the playing field. However, actually computing the score of the round was a way too algorithmic task for her. Can you help her?

Input

The first line contains two integers – the coordinates of the jack on the playing field.

The next $6$ lines each contains two integers – the coordinates of a boule that Jonna’s team threw.

The next and final $6$ lines each contains two integers – the coordinates of a boule that the opposing team threw.

The coordinates $(x, y)$ of the jack and the boules satisfy $0 \le x \le 40$ and $0 \le y \le 150$. No boule occupies the same coordinates as another boule or the jack.

Output

If Jonna’s team won the round, first output a line with JONNA. If the opponent’s team won the round, instead output OPPONENTS. If the team tied, output TIE.

If the round was not tied, then output a line with the score of the team that won the round.

Sample Input 1 Sample Output 1
20 75
22 80
30 73
39 149
32 10
12 75
22 91
27 70
25 91
35 100
15 30
30 80
17 87
JONNA
2
Sample Input 2 Sample Output 2
2 128
14 92
4 114
22 36
14 83
5 132
2 12
20 105
29 42
30 106
18 21
18 91
2 125
OPPONENTS
1
Sample Input 3 Sample Output 3
16 74
39 7
27 145
5 2
34 143
18 149
34 5
39 141
16 149
33 147
24 2
24 3
12 0
TIE

Footnotes

  1. Really called pétanque in French – boule is just the French name of the ball.

Please log in to submit a solution to this problem

Log in