题目描述
Problem Description
There is a processing called "contraction" for binary images. A binary image is an image where each pixel can only be either white or black.
Contraction is a process where for each pixel, if there is at least one black pixel among the pixel itself and its surrounding 8 directions, that pixel is turned black.
Here, consider a binary image with a height of $ H $ and a width of $ W $. It is known that this image is the result of applying contraction once to some original image. Determine if there is an original image that could have resulted in this, and if so, restore one of them.
The image is given as $ H $ strings of $ W $ characters each, $ S_i $. The $ j $-th character of $ S_i $ represents the color of the pixel at the $ i $-th row from the top and the $ j $-th column from the left, where . means white and # means black.
Input Format
The input is given from the standard input in the following format:
$ H $ $ W $ $ S_1 $ $ S_2 $ : $ S_H $
Output Format
If there is no image that satisfies the condition, output impossible in one line.
If there is an image that satisfies the condition, output possible in one line, followed by $ H $ lines of strings consisting of . and #.
The $ j $-th character of the $ i $-th line should be . if the pixel at the $ i $-th row from the top and the $ j $-th column from the left in the satisfying image is white, and # if it is black.
Sample Input and Output
Sample Input #1
4 4
##..
##..
..##
..##
Sample Output #1
possible
#...
....
....
...#
Sample Input #2
4 4
###.
####
..##
..##
Sample Output #2
possible
##..
....
...#
...#
Sample Input #3
4 4
###.
##.#
..##
..##
Sample Output #3
impossible
Notes/Hints
Constraints
- $ 1 ≦ H, W ≦ 100 $
- $ S_i $ is a string of $ W $ characters consisting of
.and#
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分