#include <bits/stdc++.h>
using namespace std;
long long i, j, n, m, e, ch = 0, be = 0, x1, x2, x3, x4;
char p[1003][1003];
vector<vector<char> > a;
vector<vector<long long> > b, c, ot;
vector<long long> y;
vector<char> q;
vector<char> o;
queue<pair<long long, long long> > w;
char r;
long long vo1(long long l, long long r) {
  if (c[l][r] == 0) {
    if (a[l][r] == 'w') {
      if (b[l][r] == 4) {
        cout << "NO";
        exit(0);
      }
      if (b[l][r] < 3)
        w.push(make_pair(l, r));
      else {
        if (l > 2 && a[l - 1][r] == 'b' && a[l - 2][r] == 'w' &&
            c[l - 1][r] == 0) {
          e++;
          c[l][r] = e;
          c[l - 1][r] = e;
          c[l - 2][r] = e;
          b[l - 3][r]++;
          b[l - 2][r - 1]++;
          b[l - 2][r + 1]++;
          b[l - 1][r - 1]++;
          b[l - 1][r + 1]++;
          b[l][r - 1]++;
          b[l][r + 1]++;
          b[l + 1][r]++;
        } else if (l + 2 <= n && a[l + 1][r] == 'b' && a[l + 2][r] == 'w' &&
                   c[l + 1][r] == 0) {
          e++;
          c[l][r] = e;
          c[l + 1][r] = e;
          c[l + 2][r] = e;
          b[l - 1][r]++;
          b[l + 3][r]++;
          b[l][r - 1]++;
          b[l][r + 1]++;
          b[l + 1][r - 1]++;
          b[l + 1][r + 1]++;
          b[l + 2][r - 1]++;
          b[l + 2][r + 1]++;
        } else if (r > 2 && a[l][r - 1] == 'b' && a[l][r - 2] == 'w' &&
                   c[l][r - 1] == 0) {
          e++;
          c[l][r] = e;
          c[l][r - 1] = e;
          c[l][r - 2] = e;
          b[l][r + 1]++;
          b[l][r - 3]++;
          b[l + 1][r]++;
          b[l + 1][r - 1]++;
          b[l + 1][r - 2]++;
          b[l - 1][r]++;
          b[l - 1][r - 1]++;
          b[l - 1][r - 2]++;
        } else if (r + 2 <= m && a[l][r + 1] == 'b' && a[l][r + 2] == 'w' &&
                   c[l][r + 1] == 0) {
          e++;
          c[l][r] = e;
          c[l][r + 1] = e;
          c[l][r + 2] = e;
          b[l][r - 1]++;
          b[l][r + 3]++;
          b[l - 1][r]++;
          b[l - 1][r + 1]++;
          b[l - 1][r + 2]++;
          b[l + 1][r]++;
          b[l + 1][r + 1]++;
          b[l + 1][r + 2]++;
        } else {
          cout << "NO";
          exit(0);
        }
      }
    } else if (a[l][r] == 'b') {
      if (b[l][r] > 2) {
        cout << "NO";
        exit(0);
      } else if (b[l][r] < 2)
        w.push(make_pair(l, r));
      else {
        if (l > 1 && l < n && a[l - 1][r] == 'w' && a[l + 1][r] == 'w' &&
            b[l - 1][r] == 0 && b[l + 1][r] == 0) {
          e++;
          c[l][r] = e;
          c[l - 1][r] = e;
          c[l + 1][r] = e;
          b[l - 2][r]++;
          b[l + 2][r]++;
          b[l - 1][r - 1]++;
          b[l - 1][r + 1]++;
          b[l][r - 1]++;
          b[l][r + 1]++;
          b[l + 1][r - 1]++;
          b[l + 1][r + 1]++;
        } else if (r > 1 && r < m && a[l][r - 1] == 'w' && a[l][r + 1] == 'w' &&
                   b[l][r - 1] == 0 && b[l][r + 1] == 0) {
          e++;
          c[l][r] = e;
          c[l][r - 1] = e;
          c[l][r + 1] = e;
          b[l][r - 2]++;
          b[l][r + 2]++;
          b[l - 1][r]++;
          b[l - 1][r - 1]++;
          b[l - 1][r + 1]++;
          b[l + 1][r - 1]++;
          b[l + 1][r]++;
          b[l + 1][r + 1]++;
        } else {
          cout << "NO";
          exit(0);
        }
      }
    }
  }
}
int main() {
  cin >> n >> m;
  for (i = 0; i <= n + 1; i++) {
    a.push_back(q);
    b.push_back(y);
    c.push_back(y);
  }
  for (i = 0; i <= m + 1; i++) {
    a[0].push_back('.');
    a[n + 1].push_back('.');
    b[0].push_back(-1);
    b[n + 1].push_back(-1);
    c[0].push_back(1);
    c[n + 1].push_back(1);
  }
  for (i = 1; i <= n; i++) {
    a[i].push_back('.');
    b[i].push_back(-1);
    c[i].push_back(1000005);
    for (j = 1; j <= m; j++) {
      cin >> r;
      a[i].push_back(r);
      b[i].push_back(0);
      c[i].push_back(0);
      if (r == 'w')
        be++;
      else if (r == 'b')
        ch++;
    }
    a[i].push_back('.');
    b[i].push_back(-1);
    c[i].push_back(1000005);
  }
  ot = c;
  if (ch * 2 != be) {
    cout << "NO";
    return 0;
  }
  e = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (a[i - 1][j] == '.') b[i][j]++;
      if (a[i + 1][j] == '.') b[i][j]++;
      if (a[i][j + 1] == '.') b[i][j]++;
      if (a[i][j - 1] == '.') b[i][j]++;
      if (b[i][j] == 4 && a[i][j] != '.') {
        cout << "NO";
        return 0;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (b[i][j] == 3 && a[i][j] != '.') {
        if (a[i][j] == 'b') {
          cout << "NO";
          return 0;
        }
        if (c[i][j] == 0) vo1(i, j);
      } else if (a[i][j] != '.')
        vo1(i, j);
    }
  }
  while (!w.empty()) {
    vo1(w.front().first, w.front().second);
    w.pop();
  }
  cout << "YES" << endl;
  for (i = 0; i < 1000010; i++) o.push_back('.');
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (a[i][j] == '.')
        p[i][j] = '.';
      else {
        if (o[c[i][j]] != '.')
          p[i][j] = o[c[i][j]];
        else if (j + 2 <= m && c[i][j] == c[i][j + 1] &&
                 c[i][j] == c[i][j + 2]) {
          x1 = 0;
          x2 = 0;
          x3 = 0;
          x4 = 0;
          if (o[c[i + 1][j]] == 'a' || o[c[i - 1][j]] == 'a' ||
              o[c[i + 1][j + 1]] == 'a' || o[c[i - 1][j + 1]] == 'a' ||
              o[c[i - 1][j + 2]] == 'a' || o[c[i + 1][j + 2]] == 'a' ||
              o[c[i][j + 3]] == 'a' || o[c[i][j - 1]] == 'a')
            x1 = 1;
          if (o[c[i + 1][j]] == 'b' || o[c[i - 1][j]] == 'b' ||
              o[c[i + 1][j + 1]] == 'b' || o[c[i - 1][j + 1]] == 'b' ||
              o[c[i - 1][j + 2]] == 'b' || o[c[i + 1][j + 2]] == 'b' ||
              o[c[i][j + 3]] == 'b' || o[c[i][j - 1]] == 'b')
            x2 = 1;
          if (o[c[i + 1][j]] == 'c' || o[c[i - 1][j]] == 'c' ||
              o[c[i + 1][j + 1]] == 'c' || o[c[i - 1][j + 1]] == 'c' ||
              o[c[i - 1][j + 2]] == 'c' || o[c[i + 1][j + 2]] == 'c' ||
              o[c[i][j + 3]] == 'c' || o[c[i][j - 1]] == 'c')
            x3 = 1;
          if (o[c[i + 1][j]] == 'd' || o[c[i - 1][j]] == 'd' ||
              o[c[i + 1][j + 1]] == 'd' || o[c[i - 1][j + 1]] == 'd' ||
              o[c[i - 1][j + 2]] == 'd' || o[c[i + 1][j + 2]] == 'd' ||
              o[c[i][j + 3]] == 'd' || o[c[i][j - 1]] == 'd')
            x4 = 1;
          if (x1 == 0) {
            o[c[i][j]] = 'a';
            p[i][j] = 'a';
            p[i][j + 1] = 'a';
            p[i][j + 2] = 'a';
          } else if (x2 == 0) {
            o[c[i][j]] = 'b';
            p[i][j] = 'b';
            p[i][j + 1] = 'b';
            p[i][j + 2] = 'b';
          } else if (x3 == 0) {
            o[c[i][j]] = 'c';
            p[i][j] = 'c';
            p[i][j + 1] = 'c';
            p[i][j + 2] = 'c';
          } else {
            o[c[i][j]] = 'd';
            p[i][j] = 'd';
            p[i][j + 1] = 'd';
            p[i][j + 2] = 'd';
          }
        }
        if (i + 2 <= n && c[i][j] == c[i + 1][j] && c[i][j] == c[i + 2][j]) {
          x1 = 0;
          x2 = 0;
          x3 = 0;
          x4 = 0;
          if (o[c[i - 1][j]] == 'a' || o[c[i + 3][j]] == 'a' ||
              o[c[i][j + 1]] == 'a' || o[c[i][j - 1]] == 'a' ||
              o[c[i + 1][j + 1]] == 'a' || o[c[i + 1][j - 1]] == 'a' ||
              o[c[i + 2][j - 1]] == 'a' || o[c[i + 2][j + 1]] == 'a')
            x1 = 1;
          if (o[c[i - 1][j]] == 'b' || o[c[i + 3][j]] == 'b' ||
              o[c[i][j + 1]] == 'b' || o[c[i][j - 1]] == 'b' ||
              o[c[i + 1][j + 1]] == 'b' || o[c[i + 1][j - 1]] == 'b' ||
              o[c[i + 2][j - 1]] == 'b' || o[c[i + 2][j + 1]] == 'b')
            x2 = 1;
          if (o[c[i - 1][j]] == 'c' || o[c[i + 3][j]] == 'c' ||
              o[c[i][j + 1]] == 'c' || o[c[i][j - 1]] == 'c' ||
              o[c[i + 1][j + 1]] == 'c' || o[c[i + 1][j - 1]] == 'c' ||
              o[c[i + 2][j - 1]] == 'c' || o[c[i + 2][j + 1]] == 'c')
            x3 = 1;
          if (o[c[i - 1][j]] == 'd' || o[c[i + 3][j]] == 'd' ||
              o[c[i][j + 1]] == 'd' || o[c[i][j - 1]] == 'd' ||
              o[c[i + 1][j + 1]] == 'd' || o[c[i + 1][j - 1]] == 'd' ||
              o[c[i + 2][j - 1]] == 'd' || o[c[i + 2][j + 1]] == 'd')
            x4 = 1;
          if (x1 == 0) {
            o[c[i][j]] = 'a';
            p[i][j] = 'a';
            p[i + 1][j] = 'a';
            p[i + 2][j] = 'a';
          } else if (x2 == 0) {
            o[c[i][j]] = 'b';
            p[i][j] = 'b';
            p[i + 1][j] = 'b';
            p[i + 2][j] = 'b';
          } else if (x3 == 0) {
            o[c[i][j]] = 'c';
            p[i][j] = 'c';
            p[i + 1][j] = 'c';
            p[i + 2][j] = 'c';
          } else {
            o[c[i][j]] = 'd';
            p[i][j] = 'd';
            p[i + 1][j] = 'd';
            p[i + 2][j] = 'd';
          }
        }
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cout << p[i][j];
    }
    cout << endl;
  }
  return 0;
}
