Dasha is fond of challenging puzzles: Rubik's Cube
3×3×3,
4×4×4,
5×5×5 and so on. This time she has a cyclic table of size
n×m, and each cell of the table contains a lowercase English letter. Each cell has coordinates
(i,j) (
0≤i<n,
0≤j<m). The table is cyclic means that to the right of cell
(i,j) there is the cell
, and to the down there is the cell
.
Dasha has a pattern as well. A pattern is a non-cyclic table of size
r×c. Each cell is either a lowercase English letter or a question mark. Each cell has coordinates
(i,j) (
0≤i<r,
0≤j<c).
The goal of the puzzle is to find all the appearance positions of the pattern in the cyclic table.
We say that the cell
(i,j) of cyclic table is an appearance position, if for every pair
(x,y) such that
0≤x<r and
0≤y<c one of the following conditions holds:
- There is a question mark in the cell (x,y) of the pattern, or
- The cell of the cyclic table equals to the cell (x,y) of the pattern.
Dasha solved this puzzle in no time, as well as all the others she ever tried. Can you solve it?.
Output
Print
n lines. Each of the
n lines should contain
m characters. Each of the characters should equal '
0' or '
1'.
The
j-th character of the
i-th (
0-indexed) line should be equal to '
1', in case the cell
(i,j) is an appearance position, otherwise it should be equal to '
0'.