#P4279. [SHOI2008] 小约翰的游戏

[SHOI2008] 小约翰的游戏

Description

Little John often plays a very interesting game with his older brother: On the table there are nn heaps of stones. Little John and his brother take turns removing stones. On each turn, a player may choose any heap and remove any positive number of stones from that heap, but may not take zero stones. We stipulate that the player who takes the last stone loses.

Little John is quite stubborn. He insists that the first player has a big advantage, so he always moves first. His brother is much smarter and has never made a mistake in the game. In anger, Little John asks you to be his adviser. Naturally, you should first write a program to predict who will win the game.

Input Format

The input consists of multiple test cases. The first line contains an integer TT (1T5001 \leq T \leq 500), indicating there are TT test cases.

For each test case, the first line contains an integer NN (1N501 \leq N \leq 50), indicating there are NN heaps of stones. Then follow NN integers, each not exceeding 50005000, representing the number of stones in each heap.

Output Format

For each test case, if John can win the game, output John; otherwise output Brother. Please pay attention to letter case.

2
3
3 5 1
1
1
John
Brother

Hint

  • For 40%40\% of the testdata, T250T \leq 250.
  • For 100%100\% of the testdata, T500T \leq 500.

Translated by ChatGPT 5