#include <bits/stdc++.h>
using namespace std;
int N, M;
char ch[1010][1010];
void Init() {
  scanf("%d%d", &N, &M);
  memset(ch, 0, sizeof(ch));
  for (int i = 1; i <= N; i++) scanf("%s", ch[i] + 1);
}
int s[1010][1010];
int x[1010 * 1010 / 3], y[1010 * 1010 / 3];
bool k[1010 * 1010 / 3];
int col[1010 * 1010 / 3];
int s_tot;
bool Paint(int id) {
  if (id == s_tot) return 1;
  col[id] = 0xf;
  int t;
  if (k[id]) {
    for (int j = -1; j <= 1; j++) {
      t = s[x[id] + 1][y[id] + j];
      if (t != -1 && col[t] != -1) col[id] &= 0xf - col[t];
      t = s[x[id] - 1][y[id] + j];
      if (t != -1 && col[t] != -1) col[id] &= 0xf - col[t];
    }
    t = s[x[id]][y[id] - 2];
    if (t != -1 && col[t] != -1) col[id] &= 0xf - col[t];
    t = s[x[id]][y[id] + 2];
    if (t != -1 && col[t] != -1) col[id] &= 0xf - col[t];
  } else {
    for (int i = -1; i <= 1; i++) {
      t = s[x[id] + i][y[id] - 1];
      if (t != -1 && col[t] != -1) col[id] &= 0xf - col[t];
      t = s[x[id] + i][y[id] + 1];
      if (t != -1 && col[t] != -1) col[id] &= 0xf - col[t];
    }
    t = s[x[id] - 2][y[id]];
    if (t != -1 && col[t] != -1) col[id] &= 0xf - col[t];
    t = s[x[id] + 2][y[id]];
    if (t != -1 && col[t] != -1) col[id] &= 0xf - col[t];
  }
  if (!col[id]) return 0;
  col[id] = col[id] - (col[id] & (col[id] - 1));
  if (Paint(id + 1)) return 1;
  col[id] = -1;
  return 0;
}
void Solve() {
  bool flag = 1;
  memset(s, -1, sizeof(s));
  s_tot = 0;
  for (int i = 1; i <= N && flag; i++) {
    for (int j = 1; j <= M; j++) {
      if (s[i][j] != -1 || ch[i][j] == '.') continue;
      if (ch[i][j] == 'b') {
        if (ch[i][j - 1] != 'w' || ch[i][j + 1] != 'w') {
          flag = 0;
          break;
        } else {
          s[i][j - 1] = s[i][j] = s[i][j + 1] = s_tot;
          x[s_tot] = i;
          y[s_tot] = j;
          k[s_tot] = 1;
          s_tot++;
        }
      }
    }
    for (int j = 1; j <= M; j++) {
      if (s[i][j] != -1 || ch[i][j] == '.') continue;
      if (ch[i][j] == 'w') {
        if (ch[i + 1][j] != 'b' || ch[i + 2][j] != 'w') {
          flag = 0;
          break;
        } else {
          s[i][j] = s[i + 1][j] = s[i + 2][j] = s_tot;
          x[s_tot] = i + 1;
          y[s_tot] = j;
          k[s_tot] = 0;
          s_tot++;
        }
      }
    }
  }
  if (!flag) {
    printf("NO\n");
    return;
  }
  memset(col, 0, sizeof(col));
  Paint(0);
  printf("YES\n");
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if (s[i][j] == -1)
        printf(".");
      else
        switch (col[s[i][j]]) {
          case 1:
            printf("a");
            break;
          case 2:
            printf("b");
            break;
          case 4:
            printf("c");
            break;
          case 8:
            printf("d");
            break;
        }
    }
    printf("\n");
  }
}
int main() {
  Init();
  Solve();
  return 0;
}
