In the land of ACM ruled a great King who became obsessed with order. The kingdom had a rectangular form, and the King divided the territory into a grid of small rectangular counties. Before dying, the King distributed the counties among his sons.
However, he was unaware that his children had developed a strange rivalry: the first heir hated the second heir, but not the rest; the second heir hated the third heir, but not the rest, and so on ... Finally, the last heir hated the first heir, but not the other heirs.
As soon as the King died, the strange rivalry among the King’s sons sparked off a generalized war in the kingdom. Attacks only took place between pairs of adjacent counties (adjacent counties are those that share one vertical or horizontal border). A county $X$ attacked an adjacent county $Y$ whenever the owner of $X$ hated the owner of $Y$. The attacked county was always conquered by the attacking brother. By a rule of honor all the attacks were carried out simultaneously, and a set of simultaneous attacks was called a battle. After a certain number of battles, the surviving sons made a truce and never battled again.
For example, if the King had three sons, named $0$, $1$ and $2$, the figure below shows what happens in the first battle for a given initial land distribution:
You were hired to help an ACM historian determining, given the number of heirs, the initial land distribution and the number of battles, what was the land distribution after all battles.
Output
For each test case, your program must print $R$ lines with $C$ integers each, separated by single spaces in the same format as the input, representing the land distribution after all battles.