#include <bits/stdc++.h>
using namespace std;
int n, m;
char s[1008][1008];
char be[1008][1008];
int dx[5] = {1, -1, 0, 0}, dy[5] = {0, 0, 1, -1};
struct Tprogram {
  void open() {
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
  }
  void close() {}
  void init() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%s", &s[i][1]);
  }
  void ran(int x1, int y1, int x2, int y2, int x3, int y3) {
    int x[4], y[4], in[6] = {0};
    x[1] = x1;
    x[2] = x2;
    x[3] = x3;
    y[1] = y1;
    y[2] = y2;
    y[3] = y3;
    for (int i = 1; i <= 3; i++)
      for (int j = 0; j <= 3; j++) {
        int tx = x[i] + dx[j], ty = y[i] + dy[j];
        if (tx < 1 || tx > n || ty < 1 || ty > m) continue;
        in[be[tx][ty]] = 1;
      }
    for (int i = 1; i <= 5; i++)
      if (!in[i]) {
        for (int j = 1; j <= 3; j++) be[x[j]][y[j]] = i, s[x[j]][y[j]] = '.';
        return;
      }
    printf("error\n");
  }
  void work() {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
        if (s[i][j] == 'w') {
          if (s[i][j + 1] == 'b' && s[i][j + 2] == 'w')
            ran(i, j, i, j + 1, i, j + 2);
          else if (s[i + 1][j] == 'b' && s[i + 2][j] == 'w')
            ran(i, j, i + 1, j, i + 2, j);
          else
            return printf("NO\n"), void();
        } else if (s[i][j] == 'b')
          return printf("NO\n"), void();
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
        if (be[i][j] == 0)
          be[i][j] = '.';
        else
          be[i][j] += 'a' - 1;
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%s\n", &be[i][1]);
  }
} Program;
int main() {
  Program.init();
  Program.work();
  return 0;
}
