Set Matrix Zeroes

MediumArrays
Next
MatrixArray

If any cell of a matrix is 0, set its entire row and its entire column to 0. Zeros created by this process must not cause further zeroing.

Input

Line 1: r and c, the number of rows and columns. Next r lines: c integers each.

Output

Print the resulting matrix, one row per line.

Constraints

1 <= r, c <= 200 -10^9 <= each value <= 10^9

Example 1
Input
3 3
1 1 1
1 0 1
1 1 1
Output
1 0 1
0 0 0
1 0 1

The zero in the middle clears the whole middle row and column.

Hints

Set Matrix Zeroes - Medium Arrays Problem | Skill Shiksha