SP206 BITMAP - Bitmap
Description
There is given a rectangular bitmap of size _n\*m_. Each pixel of the bitmap is either white or black, but at least one is white. The pixel in _i_-th line and _j_-th column is called the pixel (_i,j_). The distance between two pixels **p $ _{1} $** =(_i $ _{1} $ ,j $ _{1} $_ ) and **p $ _{2} $** =(_i $ _{2} $ ,j $ _{2} $_ ) is defined as:
d(**p $ _{1} $** ,**p $ _{2} $** )=|_i $ _{1} $ -i $ _{2} $_ |+|_j $ _{1} $ -j $ _{2} $_ |.
### Task
Write a program which:
- reads the description of the bitmap from the standard input,
- for each pixel, computes the distance to the nearest white pixel,
- writes the results to the standard output.
Input Format
The number of test cases t is in the first line of input, then t test cases follow separated by an empty line. In the first line of each test case there is a pair of integer numbers _n, m_ separated by a single space, _1
Output Format
In the _i_-th line for each test case, _1