#include <bits/stdc++.h>
const int maxn = 1010;
char ch[maxn][maxn], ans[maxn][maxn];
const int dx[4] = {0, 1, -1, 0};
const int dy[4] = {1, 0, 0, -1};
int map[maxn][maxn];
int n, m;
int Getchar() {
  int tmp = 0;
  char ch;
  while (ch = getchar())
    if (ch >= '0' && ch <= '9') break;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) tmp = tmp * 10 + ch - '0';
  return tmp;
}
bool init() {
  n = Getchar(), m = Getchar();
  int totw = 0, totb = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%s", ch[i]);
    for (int j = m; j >= 1; j--) {
      ch[i][j] = ch[i][j - 1];
      if (ch[i][j] == 'w') totw++;
      if (ch[i][j] == 'b') totb++;
    }
  }
  if (totw != 2 * totb) {
    puts("NO");
    return false;
  }
  return true;
}
bool ok = true;
void find(int i, int j, int tmp) {
  if (tmp == j + 789456)
    tmp = 0;
  else
    tmp = 1;
  bool dd[4];
  memset(dd, 0, sizeof(dd));
  int x[3], y[3];
  if (tmp == 0) x[0] = x[1] = x[2] = i, y[0] = j, y[1] = j + 1, y[2] = j + 2;
  if (tmp == 1) y[0] = y[1] = y[2] = j, x[0] = i, x[1] = i + 1, x[2] = i + 2;
  if (y[2] > m || x[2] > n) {
    ok = false;
    return;
  }
  for (int i = 0; i <= 2; i++)
    for (int j = 0; j <= 3; j++) {
      int xx = x[i] + dx[j], yy = y[i] + dy[j];
      if (ans[xx][yy] >= 'a' && ans[xx][yy] <= 'd')
        dd[ans[xx][yy] - 'a'] = true;
    }
  for (int i = 0; i <= 3; i++)
    if (!dd[i]) {
      for (int j = 0; j <= 2; j++) {
        ans[x[j]][y[j]] = i + 'a';
        ch[x[j]][y[j]] = '.';
      }
      return;
    }
  ok = false;
}
void work() {
  for (int i = 1; i <= n; i++) {
    if (!ok) break;
    for (int j = 1; j <= m; j++) {
      if (ch[i][j] == '.') continue;
      if (ch[i][j] == 'b') {
        ok = false;
        break;
      }
      if (ch[i][j + 1] == 'b')
        find(i, j, j + 789456);
      else {
        if (ch[i + 1][j] != 'b') {
          ok = false;
          break;
        }
        find(i, j, i + 654321);
      }
    }
  }
  if (!ok) {
    puts("NO");
    return;
  }
  puts("YES");
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      if (ans[i][j] >= 'a' && ans[i][j] <= 'd')
        putchar(ans[i][j]);
      else
        putchar('.');
    putchar('\n');
  }
}
int main() {
  if (init()) work();
  return 0;
}
