The Game of Life is devised by the British mathematician John Horton Conway.
This Game consists of a grid of cells, each of which is in one of possible state, live or dead.
For each generation, every cell interacts with its eight neighbors in the following rules:
The following 2 gifs are the examples of the Game of Life: ( Black = live, White = dead )

Given the initial state of n×m grid of cells.
Your task is to find the state of grid of cells after T generations.
Hint:
It's possible to access the invalid index ( arr[-1][0] ) of array when counting the neighbors.
In C, this behavior may not cause any error message.
Notice the boundary cases, and you will get AC in this problem. :)
Three integers n, m, T on the first line.
The following n lines consist m numbers for each lines.
There’re si1, si2, ..., sim on the ith line, representing the initial state of grid of cells.
sij denotes the state of cell at position (i,j), 0,1 mean dead and live respectively.
It’s guaranteed that:
Print the grid of cells after T generations.
Remember ‘\n’ after the end of each line.