Artem is building another robot. He has a network a comprising of n lines and m sections. The cell situated on the I-th line from the top and the j-th segment from the left has a worth ai,j written in it. In the event that two nearby cells contain a similar worth, the robot will break. A lattice is called acceptable if no two adjoining cells contain a similar worth, where two
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
Artem is building another robot. He has a network a comprising of n lines and m sections. The cell situated on the I-th line from the top and the j-th segment from the left has a worth
In the event that two nearby cells contain a similar worth, the robot will break. A lattice is called acceptable if no two adjoining cells contain a similar worth, where two cells are called nearby on the off chance that they share a side.
Artem needs to increase the qualities in certain cells by one to make a decent.
All the more officially, find a decent network b that fulfills the accompanying condition —
For all substantial (i,j), either bi,j=ai,j or bi,j=ai,j+1.
For the imperatives of this issue, it tends to be shown that such a framework b consistently exists. In case there are a few such tables, you can output any of them. Kindly note that you don't need to limit the number of additions.
Input
Each test contains numerous experiments. The principal line contains the number of experiments t (1≤t≤10). Portrayal of the experiments follows.
The principal line of each experiment contains two integers n,m (1≤n≤100, 1≤m≤100) — the number of lines and segments, individually.
The accompanying n lines each contain m integers. The j-th integer in the I-th line is ai,j (1≤ai,j≤109).
Output
For each case, output n lines each containing m integers. The j-th integer in the I-th line is bi,j.
Step by step
Solved in 4 steps with 1 images