Олимпиадный тренинг

Задача 23372. Rectangular field of wonders (B, A', A)


Задача

Темы:
Kolya got on the TV game "The Rectangular Field of Miracles". At the end of this game, Kolya was shown a rectangular field of size n x m cells, each cell of which contains an integer.  Kolya can
replace the numbers in some cells with the opposite ones (i.e., instead of the number x, write the number −x in the cell). Kolya will win the car if the sum of the numbers in each row and in each column is zero. Help Kolya find the right arrangement of numbers, or determine that it doesn't exist and Kolya won't be able to win.
 
Input data format
The first line contains two integers n and m (1 <= n, m <= 5)  - the size of the field.
The next n lines contain m integers separated by spaces - the numbers written in the cells of the field. All numbers modulo do not exceed 106.
 
Output format
If the answer exists, on the first line print YES, on the next n lines print m numbers separated by spaces - the numbers in the cells of the field after the changes/
If there is no answer, in the first line print NO.
Enter Output
3 3
1 1 2
2 2 4
3 3 6
YES
1 1 -2
2 2 -4
-3 -3 6