Time limit per test: 0.25
Memory limit: 65536
ASN has just invented a brand new cipher. Its key is just a H x W
matrix of 0's and 1's. A tool by Macrosoft is recommended to be used as a manager of those keys. This tool stores a fingerprint for each key to protect from storage failures. Such a fingerprint is an (H
-1) matrix consisting of 2 x
2 sums; i.e., if A
is the key and B
is the fingerprint, then Bij
. Given the fingerprint, you are to find at least one key with such fingerprint, or to report that the fingerprint is corrupt (in case no key can produce it).
The first line of the input file contains two numbers, H
(2 ≤ H
≤ 300). The next H
-1 lines contain W
-1 characters each with no spaces in between, describing the fingerprint. Each of those characters will be either
Output the key using the format similar to that of the input file: output H
lines containing W
) each, with no spaces in between.
If the fingerprint is corrupt, output
on the only line of output.