- Time limit: 1.00 s
- Memory limit: 512 MB
You are given an binary matrix where all of the values are missing except for the top & left edges. It is also guaranteed that the top left corner is a 1. Your task is to fill the missing values so that each column and each row has an even number of ones.
Input
The first line contains one integer:
The following lines contain a string of length .
Output
Print any valid way to fill the matrix. It is guaranteed that a solution always exists.
Constraints
- The characters in the matrix are either 0, 1, or ?
Example
Input:
5 11000 0???? 0???? 0???? 1????
Output:
11000 00000 01100 00101 10001