In the hadron collider, types of new particles have appeared, with A_1, \ldots, A_N particles of each type. However, most of these particles react with each other before they can be detected, so it is important for physicists to predict the final results of these reactions.
For simplicity, assume that reactions occur between two particles, resulting in one of the following outcomes depending on their types:
The first particle destroys the second,
Both particles destroy each other,
The particles collide without any effect.
You need to determine all possible outcomes of the experiment.
Each test case is described as a sequence of numbers. The first number specifies the number of particle types (1 \leq N \leq 4). The next line contains numbers, indicating the initial number of particles of each type A_i (1 \leq A_i \leq 2). The next lines form the matrix A_{ij} of size N \times N. A nonzero entry A_{ij} indicates that a particle of type destroys a particle of type upon collision. Input continues with the description of the next test. A test with N = 0 marks the end of the input data.
The first line should be a header of the form TEST : (where is the test number, starting from ). The following lines list the possible outcomes of the experiment, with each outcome on a separate line of numbers.
Example 1