Problem: There are many interesting tasks on domino tilings. For example, an interesting fact is known. Let us take a standard chessboard (8 × 8) and cut exactly two squares out of it. It turns out that the resulting board can always be tiled using dominoes 1 × 2, if the two cut out squares are of the same color, otherwise it is impossible. 

Petya grew bored with dominoes, that's why he took a chessboard (not necessarily 8 × 8), cut some squares out of it and tries to tile it using triminoes. Triminoes are reactangles 1 × 3 (or 3 × 1, because triminoes can be rotated freely), also the two extreme squares of a trimino are necessarily white and the square in the middle is black. The triminoes are allowed to put on the chessboard so that their squares matched the colors of the uncut squares of the chessboard, and also the colors must match: the black squares must be matched with the black ones only and the white ones — with the white squares. The triminoes must not protrude above the chessboard or overlap each other. All the uncut squares of the board must be covered with triminoes. 

Help Petya find out if it is possible to tile his board using triminos in the described way and print one of the variants of tiling.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 1000) — the board size. Next n lines contain m symbols each and represent the board description. If some position contains ".", then the square in this position has been cut out. Symbol "w" stands for a white square, "b" stands for a black square. It is guaranteed that through adding the cut squares can result in a correct chessboard (i.e. with alternating black and white squares), thought, perhaps, of a non-standard size.

Output

If at least one correct tiling exists, in the first line print "YES" (without quotes), and then — the tiling description. The description must contain n lines, m symbols in each. The cut out squares, as well as in the input data, are marked by ".". To denote triminoes symbols "a", "b", "c", "d" can be used, and all the three squares of each trimino must be denoted by the same symbol. If two triminoes share a side, than they must be denoted by different symbols. Two triminoes not sharing a common side can be denoted by one and the same symbol (c.f. sample).

If there are multiple correct ways of tiling, it is allowed to print any. If it is impossible to tile the board using triminoes or the correct tiling, for which four symbols "a", "b", "c", "d" would be enough, doesn't exist, print "NO" (without quotes) in the first line.

Examples

Input

6 10
.w.wbw.wbw
wbwbw.w.w.
bw.wbwbwbw
w.wbw.wbwb
...wbw.w.w
..wbw.wbw.


Output

YES
.a.aaa.ccc
baccc.c.a.
ba.dddcbab
b.aaa.cbab
...bbb.b.b
..ccc.ddd.

Input

2 2
wb
bw


Output

NO


Input

1 3
wbw


Output

YES
bbb


Input

1 3
...


Output

YES
...

Solution (in JAVA):

Solution:
//package Problems;

import java.util.*;

public class J44 {
    static int mR[]={-1,0,1,0};
    static int mC[]={0,-1,0,1};
    static boolean dentro(int x, int y, int n, int m){
        return (x>=0 && y>=0 && x<n && y<m);
    }
    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        int n, m;
        n = read.nextInt();
        m = read.nextInt();
        int contP=0;
        char T[][] = new char[n+5][m+5]; 
        for(int i=1; i<=n; ++i){
            String str = read.next();
            for(int j=1; j<=m; ++j) {
                T[i][j]=str.charAt(j-1)=='b'?'x':str.charAt(j-1);
                if(T[i][j]!='.') contP++;
            }
        }
        int contador = 0;
        int Bloq[][] = new int[n+5][m+5];
        
        /* 0 *
         * 1 a      
         * 2 b      
         * 3 c      
         * 4 d      
         * 5 ab     
         * 6 ac     
         * 7 ad     
         * 8 bc    
         * 9 bd    
         * 10 cd   
         * 11 abc  
         * 12 abd  
         * 13 acd  
         * 14 bcd  
         * 15 abcd 
         */
        //             0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
        //             *, b, a, a, a, c, b, b, a, a, a
        int Contiene[][]={
                //  a  b  c  d ab ac ad bc bd cd abc abd acd bcd abcd
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0,  0, 0, 0},
                {0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0,  1,  1,  1, 0, 1},
                {0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0,  1,  1,  0, 1, 1},
                {0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1,  1,  0,  1, 1, 1},
                {0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1,  0,  1,  1, 1, 1}
        };
        int newBloq[][] ={
                //  a  b   c   d  ab  ac  ad  bc  bd  cd abc  abd acd bcd abcd
                {0, 1, 2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15},
                {1, 1, 5,  6,  7,  5,  6,  7, 11, 12, 13, 11, 12, 13, 15, 15},
                {2, 5, 2,  8,  9,  5, 11, 12,  8,  9, 14, 11, 12, 15, 14, 15},
                {3, 6, 8,  3, 10, 11,  6, 13,  8, 14, 10, 11, 15, 13, 14, 15},
                {4, 7, 9, 10,  4, 12, 13,  7, 14,  9, 10, 15, 12, 13, 14, 15}
        };
        int color[] = {0, 0, 1, 2, 3, 2, 1, 1, 0, 0, 0, 3, 2, 1, 0, 0};
        int BloqR[] ={-1, -1, -1};
        int BloqC[] ={-1, 0, 1};
        int BloqDR[] = {-1, 0, 1};
        int BloqDC[] = {-1, -1, -1};
        
        for(int i=0; i<n+2; ++i) Arrays.fill(Bloq[i], 0);
        //for(int ww=0; ww<2; ++ww){
        for(int r=1; r<=n; ++r){
            for(int c=1; c<=m; ++c){
                    if(T[r][c]=='w'){
                        boolean dw=false;
                        boolean up=false;
                        boolean lf=false;
                        boolean ri=false;
                        if(T[r+1][c]=='x' && T[r+2][c]=='w') dw = true;                         
                        if(T[r-1][c]=='x' && T[r-2][c]=='w') up = true;
                        if(T[r][c-1]=='x' && T[r][c-2]=='w') lf = true;
                        if(T[r][c+1]=='x' && T[r][c+2]=='w') ri = true;
                        
                        if(dw && !lf && !ri && !up){
                            boolean pintado = false;
                            for(int i=1; i<=4; ++i){
                                if(Contiene[i][Bloq[r][c]]==1 || Contiene[i][Bloq[r+1][c]]==1 || Contiene[i][Bloq[r+2][c]]==1) continue;
                                
                                T[r][c]=T[r+1][c]=T[r+2][c]=(char) ('a'+ color[i]);
                                contP-=3;
                                pintado = true;
                                Bloq[r-1][c] = newBloq[i][Bloq[r-1][c]];
                                Bloq[r+3][c] = newBloq[i][Bloq[r+3][c]];
                                for(int k=1; k<=3; k++)for(int k2=0; k2<3; k2++){
                                    Bloq[r+k+BloqR[k2]][c+BloqC[k2]] = newBloq[i][Bloq[r+k+BloqR[k2]][c+BloqC[k2]]];
                                }
                                break;
                            }
                        }else if(!dw && lf && !ri && !up){
                            boolean pintado = false;
                            for(int i=1; i<=4; ++i){
                                if(Contiene[i][Bloq[r][c]]==1 || Contiene[i][Bloq[r][c-1]]==1 || Contiene[i][Bloq[r][c-2]]==1) continue;
                                //if(Bloq[r][c]==i || Bloq[r][c-1]==i || Bloq[r][c-2]==i) continue;
                                contP-=3;
                                T[r][c]=T[r][c-1]=T[r][c-2]=(char) ('a'+color[i]);
                                pintado = true;
                                Bloq[r][c+1] = newBloq[i][Bloq[r][c+1]];
                                Bloq[r][c-3] = newBloq[i][Bloq[r][c-3]];
                                for(int k=-1; k<=1; k++)for(int k2=0; k2<3; k2++){
                                    Bloq[r+BloqDR[k2]][c+BloqDC[k2]-k] = newBloq[i][Bloq[r+BloqDR[k2]][c+BloqDC[k2]-k]];
                                }
                                break;
                            }/*
                            if(!pintado){
                                System.out.println("NO");
                                System.exit(0);
                            }*/
                            //T[r][c]=T[r][c-1]=T[r][c-2]=(char) ('a'+contador++);
                        }else if(!dw && !lf && ri && !up){
                            boolean pintado = false;
                            for(int i=1; i<=4; ++i){
                                if(Contiene[i][Bloq[r][c]]==1 || Contiene[i][Bloq[r][c+1]]==1 || Contiene[i][Bloq[r][c+2]]==1) continue;
                                //if(Bloq[r][c]==i || Bloq[r][c-1]==i || Bloq[r][c-2]==i) continue;
                                contP-=3;
                                T[r][c]=T[r][c+1]=T[r][c+2]=(char) ('a'+ color[i]);
                                pintado = true;
                                Bloq[r][c-1] = newBloq[i][Bloq[r][c-1]];
                                Bloq[r][c+3] = newBloq[i][Bloq[r][c+3]];
                                for(int k=1; k<=3; k++)for(int k2=0; k2<3; k2++){
                                    Bloq[r+BloqDR[k2]][c+BloqDC[k2]+k] = newBloq[i][Bloq[r+BloqDR[k2]][c+BloqDC[k2]+k]];
                                }
                                break;
                            }/*
                            if(!pintado){
                                System.out.println("NO");
                                System.exit(0);
                            }*/
                            //T[r][c]=T[r][c+1]=T[r][c+2]=(char) ('a'+contador++);
                        }else if(!dw && !lf && !ri && up){
                            boolean pintado = false;
                            for(int i=1; i<=4; ++i){
                                if(Contiene[i][Bloq[r][c]]==1 || Contiene[i][Bloq[r-1][c]]==1 || Contiene[i][Bloq[r-2][c]]==1) continue;
                                //if(Bloq[r][c]==i || Bloq[r-1][c]==i || Bloq[r-2][c]==i) continue;
                                contP-=3;
                                T[r][c]=T[r-1][c]=T[r-2][c]=(char) ('a'+ color[i]);
                                pintado = true;
                                Bloq[r+1][c] = newBloq[i][Bloq[r+1][c]];
                                Bloq[r-3][c] = newBloq[i][Bloq[r-3][c]];
                                for(int k=-1; k<=1; k++)for(int k2=0; k2<3; k2++){
                                    Bloq[r-k+BloqR[k2]][c+BloqC[k2]] = newBloq[i][Bloq[r-k+BloqR[k2]][c+BloqC[k2]]];
                                }
                                break;
                            }/*
                            if(!pintado){
                                System.out.println("NO");
                                System.exit(0);
                            }*/                         
                            //T[r][c]=T[r-1][c]=T[r-2][c]=(char) ('a'+contador++);
                        }
                    }else if(T[r][c]=='x'){
                        boolean vert=false;
                        boolean hor=false;
                        try{
                            if(T[r+1][c]=='w' && T[r-1][c]=='w') vert = true;
                            if(T[r][c-1]=='w' && T[r][c+1]=='w') hor = true;
                        }catch (Exception e) {}
                        int rr = r;
                        int cc = c;
                        if(vert && !hor){
                            r--;
                            boolean pintado = false;
                            for(int i=1; i<=4; ++i){
                                if(Contiene[i][Bloq[r][c]]==1 || Contiene[i][Bloq[r+1][c]]==1 || Contiene[i][Bloq[r+2][c]]==1) continue;
                                //if(Bloq[r][c]==i || Bloq[r+1][c]==i || Bloq[r+2][c]==i) continue;
                                contP-=3;
                                T[r][c]=T[r+1][c]=T[r+2][c]=(char) ('a'+color[i]);
                                pintado = true;
                                Bloq[r-1][c] = newBloq[i][Bloq[r-1][c]];
                                Bloq[r+3][c] = newBloq[i][Bloq[r+3][c]];
                                for(int k=1; k<=3; k++)for(int k2=0; k2<3; k2++){
                                    Bloq[r+k+BloqR[k2]][c+BloqC[k2]] = newBloq[i][Bloq[r+k+BloqR[k2]][c+BloqC[k2]]];
                                }
                                break;
                            }/*
                            if(!pintado){
                                System.out.println("NO");
                                System.exit(0);
                            }*/
                            r=rr;
                            c=cc;
                            //T[r][c]=T[r-1][c]=T[r+1][c]=(char) ('a'+contador++);
                        }else if(!vert && hor){
                            c--;
                            boolean pintado = false;
                            for(int i=1; i<=4; ++i){
                                if(Contiene[i][Bloq[r][c]]==1 || Contiene[i][Bloq[r][c+1]]==1 || Contiene[i][Bloq[r][c+2]]==1) continue;
                                contP-=3;
                                T[r][c]=T[r][c+1]=T[r][c+2]=(char) ('a'+ color[i]);
                                pintado = true;
                                Bloq[r][c-1] = newBloq[i][Bloq[r][c-1]];
                                Bloq[r][c+3] = newBloq[i][Bloq[r][c+3]];
                                for(int k=1; k<=3; k++)for(int k2=0; k2<3; k2++){
                                    //try{
                                    Bloq[r+BloqDR[k2]][c+BloqDC[k2]+k] = newBloq[i][Bloq[r+BloqDR[k2]][c+BloqDC[k2]+k]];
                                    /*}catch(Exception ex){
                                        System.out.printf("i=%d, c=%d, r=%d, k2=%d, k=%d, BloqC[k2]=%d, BloqR[k2]=%d\n", i, c, r, k2, k, BloqC[k2], BloqR[k2]);
                                        System.out.printf("newBloq[i][Bloq[r+BloqR[k2]][c+BloqC[k2]+k]]=%d\n",
                                                newBloq[Bloq[r+BloqR[k2]][c+BloqC[k2]+k]]);
                                    }*/
                                }
                                break;
                            }/*
                            if(!pintado){
                                System.out.println("NO");
                                System.exit(0);
                            }*/
                            r=rr;
                            c=cc;
                            //T[r][c]=T[r][c-1]=T[r][c+1]=(char) ('a'+contador++);
                        }
                    }
                /*for(int i=1; i<=n; ++i){for(int j=1; j<=m; ++j) System.out.print(T[i][j]);System.out.println();}
                System.out.println("--------------");
                //for(int i=1; i<=n; ++i){for(int j=1; j<=m; ++j) System.out.print(Bloq[i][j]);System.out.println();}
                //System.out.println("--------------");
                    for(int i=1; i<=n; ++i){for(int j=1; j<=m; ++j) System.out.printf("%3d", Bloq[i][j]);System.out.println();}
                    System.out.println("--------------");*/
            }           
        }
        //}
        //for(int i=1; i<=n; ++i){for(int j=1; j<=m; ++j) System.out.printf("%3d", Bloq[i][j]);System.out.println();}
        //System.out.println("--------------");
        
        if(contP>0){
            System.out.println("NO");
            System.exit(0);
        }
        System.out.println("YES");
        for(int i=1; i<=n; ++i){
            for(int j=1; j<=m; ++j) System.out.print(T[i][j]);
            System.out.println();
        }
    }

}