Mathematician Andris likes different puzzles and one of his favorites is covered box of mirrors. If we look at the horizontal cross-section of such a box, we can see that its basement contains square cells ( rows, and columns). In each cell there can be placed mirror which is oriented diagonally from lower left corner to upper right corner. Both sides of the mirror reflect light. At the box edges opposite to each cell row or column there is a gap through which you can light a beam into box or the beam can come out of the box. Through each gap you can light the beam in only one direction–perpendicular to the edge containing the gap. Therefore, beam reflecting from mirror changes its direction by degrees. When the beam goes through empty cells, its direction doesn’t change. Gaps are numbered consecutively from to , around the box, counter-clockwise, starting from the gap on the left side of the upper left cell and going downwards. Since arrangement of mirrors in the box is not visible, the only way to determine it is by lighting beams in some gaps and watching where light comes out.

Write program that:
- reads the size of the box and gaps describing beams coming in and out of the box from the input,
- determines in which cells there are mirrors and which cells are empty,
- writes the result to the output.
If there are several possible solutions, your program should output anyone of them.
输入格式
First line of input contains two positive integers: (the number of cells rows, ) and (the number of cells columns, ) separated by a single space. Each of the following lines contains one positive integer. The number in the -th line denotes the number of gap from which light comes out if it is lightened into gap number .
输出格式
Your program should write to the output lines, each of them containing integers separated by single spaces. The -th number in the -th line should be , if there is a mirror in the cell in the -th row and -th column of the box, or it should be if the cell is empty.