http://acm.hdu.edu.cn/showproblem.php?pid=1907
//题目可以简单概括为,有n堆火柴,john和Brother轮流从一堆取若干根,
//不可不取,john先手,最后取完者为负;
//简单尼姆博弈,注意当全部为孤单堆的情况,有奇数个孤单堆必败。
#include<cstdio>
int main()
{
int t,n,a,sum,s;
scanf("%d",&t);
while(t--)
{
sum=0;
s=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&a);
s^=a;
sum+=a;
}
if(sum==n)//全部为孤单堆
{
if(sum%2==0) printf("John\n");
else printf("Brother\n");
}
else
{
if(s==0) printf("Brother\n");
else printf("John\n");
}
}
return 0;
}