Task
Little Square’s school is organising the annual football match. The two team captains are Little Square and Little Triangle. They will select their teams from the classes in the school. The team selection works in the following way:
- Little Square and Little Triangle alternate picking people in turns. Little Square goes first.
- In a turn, only students from a single class can be chosen.
- In a turn, at least one and at most students can be chosen.
- In a turn, one must select at most as many students as were selected in the previous turn.
- The captain who selects the last student(s) gets the "Fo()otball" prize.
The captains do not care how many students they select overall, and all students are identical when it comes to football skill. They only care about the "Fo()otball" prize. Assuming both have perfect strategy, who wins it?
Input data
Each test file will contain multiple test cases, describing different scenarios. On the first line you will find , the number of testcases. Their descriptions follow. On the first line of a testcase you will find and . On the second line of a testcase you will find positive integers, which represent the sizes of the classes in Little Square’s school.
Output data
Output the answers for the testcases, each on the same line, not separated by spaces. If Little Square wins the prize in a testcase, output ; output otherwise.
Constraints and clarifications
- Let be the sum of the values of for all testcases in a testfile. Then
- , size of any class
# | Points | Restrictions |
---|---|---|
1 | 26 | |
2 | 8 | , , size of any class |
3 | 11 | , size of any class |
4 | 8 | , , size of any class |
5 | 16 | |
6 | 16 | |
7 | 7 | is a power of |
8 | 8 | No additional constraints |
Example
stdin
3
3 1
3 1 1
5 2
2 1 1 1 1
1 2
3
stdout
111
Explanation
In the first test, there are students in total, and exactly one student must be selected on each turn (as ). Thus, selection will last exactly turns, and the last student will be selected on Little Square’s turn, and Little Square wins.
In the second test, Little Square can first select two students from the first class. Then, after four further turns in which each captain selects one student (since all the classes have only one student at this point), Little Square wins.
In the third test, one winning strategy has Little square first selecting one student.