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.

Let us consider a circuit consisting of gates. The gates are numbered from to . Each gate has a certain number of inputs and exactly one output. Each of them (inputs and outputs) may be in either one of the states , or . Each input is connected to exactly one output of some gate. Input's state equals the state of the output it is connected to. Each output may be connected to an arbitrary number of inputs. The gates with numbers and are special - they don't have any input at all while their outputs are always in the following states: for a gate with a number , for a gate with a number . We say that the state of the output of a gate (in short: gate's state) is *valid*, if:

- it equals and the gate has more inputs in state than in state .
- it equals and the gate has the same number of inputs in state as in state .
- it equals and the gate has more inputs in state than it has in state .
- the gate is special, i.e. it's number is or , and its state is or respectively.

We say that a circuit's state is *valid* if all the states of its gates are valid. We say that a gate's state is *fixed* if the gate is in the same state in all circuit's valid states.

Write a programme that:

- reads the circuit's description from the standard input,
- for each gate checks if it's state is fixed, and determines it, if so,
- writes the determined states of gates to the standard output.

The first line of the standard input contains the number of gates , . The following lines contain the descriptions of gates' connections - line no. describes inputs of the gate no. . There is the number of inputs of this gate, followed by numbers of gates, . Those are the numbers of gates whose outputs are connected to successive inputs of the gate's no. . Numbers in each line are separated by single spaces. The total number of all inputs of all gates does not exceed .

Your programme should write lines to the standard output. Depending on the state of gate no. , 'th line should contain:

`0`- if it is determined and equals ,`1/2`- if it is determined and equals ,`1`- if it is determined and equals ,`?`(question mark) - if it is not determined.

For the input data:

5 2 0 1 2 4 2 2 2 4

the correct result is:

0 1 1/2 ? ?

*Task author: Bartosz Walczak.*