There's an N X M board which filled with black and white chesses.
In each move, the player can flip one of these N X M chesses, meanwhile some chesses of its 8 neighbors will switch into its opposite color(from black to white and from white to black).
Here's four change pattern of the flip operation:
.*.
**.
.**
.**
Input
There are multiple test cases (no more than 150).
The first line of each case contains two integer numbers N and M (1 <= N, M <= 15), indicating the width and the height of the board.
The following N lines containing M characters each describe the initial state of the board. '0' and '1' correspond to white and black, respectively.
Input ends with 0 0.
Output
For each test case output the optimal solution, the pattern should be choosen follows by the minimal number of operations.
If none of these four pattern can switch the board into all white, output "Impossible" for the test case.
Sample Input
1 1
1
3 2
11
10
11
5 5
00000
00110
01110
00100
00000
0 0
Sample Output
1 1
4 1
3 1