The first line of the input consists in the number n<=400 of lines. The second line contains m<=400 , the number of columns. Then comes the n lines of the matrix. Each line consists in m characters `0' or `1'.
The input matrix is chosen so that there exists only one smart permutation which preserves column 0 in position 0. To make things easier, any two columns share few common one entries.
The output consists of m numbers indicating the smart permutation of the columns. The first number must be 0 as column 0 does not move. The second number indicate the index (in the input matrix) of the second column, and so on.
3 4 0110 0001 1101
0 3 1 2
Sample input2
6
5
01010
01000
10101
10100
00011
00101
Sample output2
0
2
4
3
1
Sample input3
21
20
00101000000000000000
10010010010110010100
00101101000000000000
01000000000000001000
00000101100000100000
01000000100000100000
00000010000110000000
01000000000001001000
00000000001001000011
00001000000000000000
10000000000000000100
00010010011000010011
01111101111001111011
01000000000001101011
01100101100001101001
00100101100000000000
00010000001001000011
01010000101001111011
00000010010010010000
00010010011111010111
00101001000000000000
Sample output3
0
17
11
12
6
9
15
3
10
18
19
13
16
1
14
8
5
7
2
4