In the event of technical difficulties with Szkopuł, please contact us via email at szkopul@fri.edu.pl.

If you are familiar with IRC chat, the support team is also reachable on PIRC network (`irc.pirc.pl`

) in `#szkopul`

channel. If you are not, just use email.

Please do not ask us things like "how to solve task XYZ?".

Please remember that the support team has to sleep sometimes or go to work in real life.

Stripes is a two player game. Necessary requisites are a board and rectangular stripes in three colours: red, green and blue. All the red stripes have dimensions , green - , and blue - , where , and are integers. Players have at their disposal an unlimited pool of stripes of each colour.

A game board is a rectangle of dimensions and consists of fields of size .

Players make their moves by turns. Move consists of laying a stripe of any colour on the board. There are the following rules in force:

- A stripe cannot stick out of the board,
- The covering (even partially) the earlier laid stripes is forbidden.
- The ends of a stripe have to adhere to the edges of the fields on the board. The player, who is not able to perform his move in accordance to the game rules first, loses.

The first player is this one, who makes the first move in the game. It is said, that the first player has a winning strategy, if independently of the moves of the second player he can always win.

Write a program which:

- reads from the standard input sizes of stripes and of at least one board,
- for each board determines, whether the first player has a winning strategy,
- writes the results to the standard output.

The first line of the standard input consists of three integers , and , , equal to the lengths of stripes, adequately: red, green and blue ones. Numbers in the line are separated by single spaces.

The second line of the standard input consists of one number , , which is equal to the number of different boards to consider. Lines from the 3-rd to the ()-th consists of one number , . Number in the ()-th line is the length of the -th board.

The standard output should contain lines. Only one number should be written in the -th line of the file:

- 1 - if the first player has a winning strategy on the -th board
- 2 - otherwise.

For the input data:

1 5 1 3 1 5 6

the correct result is:

1 1 2

*Task author: Adam Borowski.*