The beta version of StarCowraft II is ready! Farmer John and Bessie are testing it, trying different strategies in one-on-one battles against each other's armies. The goal in StarCowraft II is to defeat your opponent's army in a battle.
Each player's army fights in a battle. An army comprises as many as three different types of "units", with respective strengths denoted by constant positive real numbers unknown to the players: cattlebruisers with strength $S_1$, cow templars with strength $S_2$, and ultracows with strength $S_3$. The only bounding information given is that no unit is more than 100 times as strong as any other unit; that is, $S_i \le 100 \cdot S_j$ for every pair $i, j$.
An army's total strength is the sum of the individual strengths of each of its units. For example, an army that has, among other units, 23 cattlebruisers gains $23 \cdot S_1$ strength just from those cattlebruisers.
When two opposing armies fight, the army with the higher total strength wins. If the two armies have exactly equal total strength, one of the players wins at random.
Farmer John and Bessie played $N$ ($0 \le N \le 300$) "test battles". In the $i$-th test battle, FJ's army had $J_{1,i}$ cattlebruisers, $J_{2,i}$ cow templars, and $J_{3,i}$ ultracows ($0 \le J_{1,i} + J_{2,i} + J_{3,i} \le 1000$). Similarly, Bessie's army had $B_{1,i}$ cattlebruisers, $B_{2,i}$ cow templars, and $B_{3,i}$ ultracows ($0 \le B_{1,i} + B_{2,i} + B_{3,i} \le 1000$). After the armies fought, FJ and Bessie recorded the winner as a single "victory letter" $V_i$: "J" if Farmer John won, "B" if Bessie won.
Although these victory results are the only information they have, they hope to predict the outcomes of some additional battles when given the unit compositions of the two opposing armies. For some battles, though, it might not be possible to determine the winner with certainty.
Given the results of the $N$ test battles Farmer John and Bessie already played, write a program that decides the winner (when possible) for $M$ ($1 \le M \le 2000$) new battles.
The reported results of the test battles are correct; there exists at least one set of strength values $S_1, S_2, S_3$ consistent with them.
To demonstrate how army strength is evaluated, consider these test battles fought in a game where we (but neither FJ nor Bessie) know that $S_1 = 9.0$, $S_2 = 7.0$, and $S_3 = 4.0$:
---- Farmer John ---- ------- Bessie ------ Battle
J1 J2 J3 J_Strength B1 B2 B3 B_Strength Outcome
6 5 4 105 5 4 7 101 J
5 4 2 81 3 5 5 82 B
9 0 10 121 8 2 7 114 J
These results imply the following deduced outcomes, for the reasons shown:
---- Farmer John ---- ------- Bessie ------ Battle
J1 J2 J3 J_Strength B1 B2 B3 B_Strength Outcome
6 6 4 112 5 4 7 101 J
FJ's army is even stronger than in test battle 1
9 0 10 121 8 2 6 110 J
Bessie's army is even weaker than in test battle 3
The first two new battles in the example correspond to the two battles deduced in the description. The result of the third new battle cannot be determined with only the information Farmer John and Bessie currently have. Specifically, both $S_1 = 9.0, S_2 = 7.0, S_3 = 4.0$ and $S_1 = 12.0, S_2 = 20.0, S_3 = 10.0$ are consistent with the test battles, but they give different results when plugged into the third new battle.