Your goal is to write a solver for Nurikabe, a binary determination puzzle. The puzzle is played on a grid, typically rectangular (with no standard size) containing empty and numbered cells. You must decide for each cell if it is white (land) or black (water), so that it satisfies the following constraints. An Island is a maximal connected region of white cells.
Note that diagonal adjacency doesn't count as connectedness. You can assume there is always a unique solution for each puzzle.
There are multiple test cases in the input. The first line of each test case contains two numbers n
The output for each test case should show the solved puzzle. Show black (water) cells with `#'. Write an empty line in the output after each puzzle.
Output
Sample Input
3 4
3...
....
.4..
5 5
2.5..
.....
.....
.....
..4.3
0 0
Sample Output
3..#
####
.4..
2#5..
.#.##
##.#.
.###.
..4#3