#C4498. Determine the Game Winner
Determine the Game Winner
Determine the Game Winner
You are given a number of test cases. For each test case, you will receive a pair of integers p and q, an integer m denoting the length of a sequence, and a sequence of m integers. Although the integers p and q are provided, the outcome solely depends on the sequence.
The rule is as follows: if the number of unique elements in the sequence is strictly less than m, the winner is Jane; otherwise, the winner is John. It is assumed that both players play optimally.
Note: All input is read from standard input and output is printed to standard output.
inputFormat
The first line contains an integer t (1 ≤ t ≤ 104) - the number of test cases. For each test case, the input contains:
- A line with two integers p and q (these values are provided for completeness but are not used in the decision making).
- A line with an integer m (1 ≤ m ≤ 105) - the length of the sequence.
- A line with m integers representing the sequence.
All numbers are separated by spaces.
outputFormat
For each test case, print a single line containing either John
or Jane
(without quotes) depending on who wins the game.
2
1 2
5
1 2 3 4 5
3 5
4
10 10 10 20
John
Jane
</p>