In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].

If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.

ByteGuy Sponge University in Byteland has recently been leading in collegiate programming contests. Its best team - Byteland Vultures - won championships of the universe in this elite domain. Not only have they won all of the qualification rounds, but also each time they solved all problems long before the end of the contest (standard 5 hours). In order not to get bored, while other teams were trying to solve some problems, Byteland Vultures played the following game:

The first player takes a square board of dimensions and removes some of its fields. The second player has to put rooks onto the remaining fields of the board, obeying following rules:

- a rook can be put only onto a field which has not been removed,
- there can be at most one rook on each field,
- no two rooks can check each other (in each row and each column there must be exactly one rook).

This version of the game turned out to be too simple for the galactic champions, so they modified the rules in the following way. The players no longer place rooks. Instead, the are to find the number of ways to put rooks onto the board obeying the above rules. The player who gives the correct answer first becomes the winner. The number of possible configurations can be huge, e.g. in case of a board with no fields removed, rooks can be positioned in ways. However, is that a problem for the champions of the universe? They perform all calculations in mind.

You might not be the world champion yet, so the task for you will be simpler. It is sufficient to write a program which determines whether the number of configurations of rooks is even or odd.

Write a program, which:

- reads description of the board,
- determines, if the number of configurations of rooks is even or odd.
- writes the answer.

The first line contains one natural number - the number of boards (). Following, there are data sets. The first line of each data set consists of one natural number - the dimension of the board (). In the following lines there are descriptions of consecutive rows of the board. In each of these rows there are numbers from the set \{\}, separated with single spaces. The number means that a given field has been removed, while means that a rook can be put onto this field.

Your program should write integers, each of them in a separate line. The -th line should contain exactly one number - or - , if the number of configurations of rooks for the -th board is even, or otherwise.

For the input data:

2 3 1 1 1 1 1 0 1 0 1 3 1 0 0 0 1 0 0 0 1

the correct result is:

1 1

The illustration of all possible configurations of rooks for the first board from the example input.

*Task author: Michal Adamaszek.*