Game#7885

Game

1 second
64 megabytes
Easy

Two players are engaged in a game involving piles of matches lined up in a row on a table. The game proceeds as follows:

The winner is the player who takes the last match.

Develop a program that, given the initial sizes of the piles, determines which player will win if both play optimally.

Input

The input begins with a single integer (1 \leq T \leq 10), representing the number of test cases. Each of the following lines describes a test case with the format: an integer (1 \leq N \leq 1000) followed by integers indicating the sizes of the piles. Each pile size does not exceed . The total sum of across all test cases does not exceed .

Output

The output should consist of lines. Each line should contain the number if the first player wins with optimal play in the corresponding test case, or if the second player wins.

Examples

Example 1

Loading
Loading

Scoring

The following conditions are guaranteed:

  1. For of the test cases, T = 3 and all N = 3, with each pile containing up to matches.

  2. For another of the test cases, T = 3 and all N = 3, with each pile containing no more than matches.

  3. For an additional of the test cases, T = 6 and all N = 3, with each pile containing no more than matches.

  4. The remaining of the test cases have no additional restrictions.