Given a matrix, if any of the cells in the matrix is 0, set all the elements in its row and column to 0.
1 1 1 1 0 1
1 0 1 => 0 0 0
1 1 1 1 0 1
0 1 2 0 0 0
3 4 5 => 0 4 5
1 2 3 0 2 3
0 1 0 0 0 0
3 4 5 => 0 4 0
1 2 3 0 2 0
0 1 0 0 0 0
3 0 5 => 0 0 0
1 2 3 0 0 0
The first line contains ‘T’ denoting the number of test cases.
For each test case, the input consists of the following lines:
For each test case, the output contains n lines, each containing m space-separated integers denoting the resultant matrix.
4
2 2
1 0
0 0
3 3
1 1 0
1 1 1
1 1 1
3 3
1 1 1
1 1 0
1 1 1
4 2
1 0
1 0
1 0
1 0
0 0
0 0
0 0 0
1 1 0
1 1 0
1 1 0
0 0 0
1 1 0
0 0
0 0
0 0
0 0
1 <= T <= 100
1 <= m,n <= 100
1 <= matrix[i][j] <= 10000