#598
Unrated
Circular Barn
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Farmer John and his archnemesis Farmer Nhoj are playing a game in a circular barn. There are NN (1N1051 \leq N \leq 10^5) rooms in the barn, and the iith room initially contains aia_i cows (1ai51061 \leq a_i \leq 5\cdot 10^6). The game is played as follows:

Both farmers will always be in the same room. After entering a room, each farmer takes exactly one turn, with Farmer John going first. Both farmers initially enter room 11.If there are zero cows in the current room, then the farmer to go loses. Otherwise, the farmer to go chooses an integer PP, where PP must either be 11 or a prime number at most the number of cows in the current room, and removes PP cows from the current room.After both farmers have taken turns, both farmers move to the next room in the circular barn. That is, if the farmers are in room ii, then they move to room i+1i+1, unless they are in room NN, in which case they move to room 11.

Determine the farmer that wins the game if both farmers play optimally.

입력

The input contains TT test cases. The first line contains TT (1T10001 \leq T \leq 1000). Each of the TT test cases follow.

Each test case starts with a line containing NN, followed by a line containing a1,,aNa_1,\dots,a_N.

It is guaranteed that the sum of all NN is at most 21052\cdot 10^5.

출력

For each test case, output the farmer that wins the game, either "Farmer John" or "Farmer Nhoj."

예제 입력 1

5
1
4
1
9
2
2 3
2
7 10
3
4 9 4

예제 출력 1

Farmer Nhoj
Farmer John
Farmer John
Farmer John
Farmer Nhoj

점수

Inputs 2-4 satisfy N=1N=1.Inputs 1, 2, and 5-7 satisfy ai1000a_i\le 1000.Inputs 8-20 satisfy no additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.