#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 6;
char t[MAXN][MAXN];
char ans[MAXN][MAXN];
int n, m;
void bad() {
  cout << "NO";
  exit(0);
}
void _test(int x, int y, bool& ca, bool& cb, bool& cc, bool& cd) {
  if (ans[y][x] == 'a')
    ca = false;
  else if (ans[y][x] == 'b')
    cb = false;
  else if (ans[y][x] == 'c')
    cc = false;
  else if (ans[y][x] == 'd')
    cd = false;
}
void test(int x, int y, bool& ca, bool& cb, bool& cc, bool& cd) {
  _test(x, y, ca, cb, cc, cd);
  if (x > 0) _test(x - 1, y, ca, cb, cc, cd);
  if (y > 0) _test(x, y - 1, ca, cb, cc, cd);
  if (x < m - 1) _test(x + 1, y, ca, cb, cc, cd);
  if (y < n - 1) _test(x, y + 1, ca, cb, cc, cd);
}
int main() {
  string str;
  memset(ans, '#', sizeof(ans));
  int i, j;
  scanf("%d %d\n", &n, &m);
  for (i = 0; i < n; ++i) {
    getline(cin, str);
    for (j = 0; j < m; ++j) {
      t[i][j] = str[j];
      if (t[i][j] == '.') ans[i][j] = '.';
    }
  }
  bool c[4];
  int k;
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) {
      if (t[i][j] == '.') continue;
      if (t[i][j] == 'b') bad();
      if (i + 2 < n && t[i + 1][j] == 'b' && t[i + 2][j] == 'w' &&
          (j == m - 1 || t[i][j + 1] != 'b')) {
        t[i][j] = t[i + 1][j] = t[i + 2][j] = '.';
        memset(c, true, sizeof(c));
        test(j, i, c[0], c[1], c[2], c[3]);
        test(j, i + 1, c[0], c[1], c[2], c[3]);
        test(j, i + 2, c[0], c[1], c[2], c[3]);
        for (k = 0; k < 4 && !c[k]; ++k)
          ;
        if (k == 4) bad();
        ans[i][j] = ans[i + 1][j] = ans[i + 2][j] = 'a' + k;
        continue;
      }
      if (j + 2 < m && t[i][j + 1] == 'b' && t[i][j + 2] == 'w') {
        t[i][j] = t[i][j + 1] = t[i][j + 2] = '.';
        memset(c, true, sizeof(c));
        test(j, i, c[0], c[1], c[2], c[3]);
        test(j + 1, i, c[0], c[1], c[2], c[3]);
        test(j + 2, i, c[0], c[1], c[2], c[3]);
        for (k = 0; k < 4 && !c[k]; ++k)
          ;
        if (k == 4) bad();
        ans[i][j] = ans[i][j + 1] = ans[i][j + 2] = 'a' + k;
        continue;
      }
      bad();
    }
  }
  for (i = 0; i < n; ++i)
    for (j = 0; j < m; ++j)
      if (ans[i][j] == '#') bad();
  puts("YES");
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) putchar(ans[i][j]);
    printf("\n");
  }
  return 0;
}
