{"raw_statement":[{"iden":"problem statement","content":"We have a canvas represented as a $H \\times W$ grid. Let $(i, j)$ denote the square at the $i$\\-th row $(1 \\leq i \\leq H)$ from the top and $j$\\-th column $(1 \\leq j \\leq W)$ from the left.\nInitially, $(i, j)$ is in the following state.\n\n*   If $c_{i, j}=$`1`: painted in Color 1.\n*   If $c_{i, j}=$`2`: painted in Color 2.\n*   If $c_{i, j}=$`3`: painted in Color 3.\n*   If $c_{i, j}=$`4`: painted in Color 4.\n*   If $c_{i, j}=$`5`: painted in Color 5.\n*   If $c_{i, j}=$`.`: not yet painted.\n\nCreate a way to paint each unpainted square in Color 1, 2, 3, 4, or 5 so that no two horizontally or vertically adjacent squares have the same color. It is not allowed to change the color of a square that is already painted."},{"iden":"constraints","content":"*   $1 \\leq H, W \\leq 700$\n*   $c_{i, j}$ is `1`, `2`, `3`, `4`, `5`, or `.`.\n*   At least one square is unpainted.\n*   There is at least one way to paint the squares under the condition."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$H$ $W$\n$c_{1, 1}$$c_{1, 2}$$\\ldots$$c_{1, W}$\n$c_{2, 1}$$c_{2, 2}$$\\ldots$$c_{2, W}$\n $:$\n$c_{H, 1}$$c_{H, 2}$$\\ldots$$c_{H, W}$"},{"iden":"sample input 1","content":"3 3\n...\n...\n..."},{"iden":"sample output 1","content":"132\n313\n541\n\nSample Output 1 corresponds to the following coloring.\n![image](https://img.atcoder.jp/arc131/35bb8a98465fbb2c889ea532d0985ff0.png)"},{"iden":"sample input 2","content":"5 7\n1.2.3.4\n.5.1.2.\n3.4.5.1\n.2.3.4.\n5.1.2.3"},{"iden":"sample output 2","content":"1425314\n2531425\n3142531\n4253142\n5314253\n\nSample Output 2 corresponds to the following coloring.\n![image](https://img.atcoder.jp/arc131/a2fc3903965fd871d25e905fb95dbc6a.png)"},{"iden":"sample input 3","content":"1 1\n."},{"iden":"sample output 3","content":"4"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}