Josh is bored of playing Nim, so he has decided to make his own variant! He will play against Mike, with the following rules:
There are piles of stones labelled from to , with the -th pile initially containing stones. Josh and Mike will take alternating turns, with Josh going first. On each turn:
- The current player should select a pile which contains at least one stone. If no such pile exists, then the current player immediately loses and their opponent wins.
- Then, their opponent will remove any positive integer number of stones from pile of their choosing. Of course, they cannot remove more stones from pile than there are currently.
If both Josh and Mike play optimally, who will win? You are to answer this question for separate games.
Constraints
The sum of over all games does not exceed .
Subtask 1 [20%]
Subtask 2 [20%]
Subtask 3 [60%]
No additional constraints.
Input Specification
The first line contains a single integer, , denoting the number of games. Then, pairs of lines follow, with the -th pair describing the -th game.
The first line of each pair contains a single integer, .
The second line of each pair contains space-separated integers, .
Output Specification
Output lines. The -th line should contain Josh
if Josh will win, and Mike
if Mike will win.
Sample Input
2
1
2
2
1 2
Sample Output
Mike
Josh
Explanation
In the first game, Josh has no choice but to choose pile . Then, Mike can remove one stone from this pile. On Mike's turn, he will again choose pile , and Josh will be forced to remove the remaining stone. On Josh's next turn, all of the piles are empty, so Josh loses.
In the second game, Josh can begin by choosing pile . Then, Mike will be forced to remove the only stone from this pile, making it empty. There is now only one pile left, containing stones, so using our logic from the first game, we can determine that Josh can force a win.
Comments