Matrix Problem
题号:NC221778
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

A teacher gives his students a problem to test his students' construction skills.

The teacher has two  matrices and with rows and columns, where all the  of both matrices separately form a -connected block. -connected means that each cell is connected with adjacent cells in four directions (up, down, leftward and rightward).

Now the teacher gives a third matrix with rows and columns, and a specific position of this matrix is if and only if the corresponding positions of the two matrices are .

You need to find two matrices and such that one of the positions of is if and only if the corresponding positions of are both .

输入描述:

The first line contains two integers  and   -- the size of the matrices.

The next  lines describe the matrix . Each of the following lines contains characters or .

It is guaranteed that the boundaries of the matrix are , i.e., the -st row, the -st column, the -th row and the -th column of the matrix are .

输出描述:

Print  lines and each line has  characters  or .

The first lines describe the matrix .

The next lines describe the matrix .

If there are multiple answers, print any of them.

示例1

输入

复制
5 5
00000
00100
01010
01100
00000

输出

复制
00000
00100
01110
01100
00000
00000
01110
01010
01110
00000