#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, m;
int w, b;
char s[N][N];
char mp[N * N];
vector<int> diff[N * N];
int a[N][N], cnt[N][N];
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
bool hori(int i, int j) {
  return !a[i - 1][j] && s[i - 1][j] == 'w' && !a[i + 1][j] &&
         s[i + 1][j] == 'w';
}
bool verti(int i, int j) {
  return !a[i][j - 1] && s[i][j - 1] == 'w' && !a[i][j + 1] &&
         s[i][j + 1] == 'w';
}
void go(vector<pair<int, int> > &v, queue<pair<int, int> > &q) {
  for (auto t : v) {
    int x = t.first, y = t.second;
    if (s[x][y] == 'w') {
      for (int i = 0; i < 4; ++i) {
        int nx = x + dx[i], ny = y + dy[i];
        if (!a[nx][ny] && s[nx][ny] == 'b') {
          cnt[nx][ny] = hori(nx, ny) + verti(nx, ny);
          if (cnt[nx][ny] == 1) q.push(make_pair(nx, ny));
        }
      }
    }
  }
}
void draw(vector<pair<int, int> > &v, int stamp) {
  for (auto t : v) {
    int x = t.first, y = t.second;
    a[x][y] = stamp;
  }
}
void print() {
  puts("YES");
  for (int x = 1; x <= n; ++x) {
    for (int y = 1; y <= m; ++y) {
      if (a[x][y]) {
        for (int i = 0; i < 4; ++i) {
          int nx = x + dx[i], ny = y + dy[i];
          if (a[nx][ny] && a[nx][ny] != a[x][y]) {
            diff[a[x][y]].push_back(a[nx][ny]);
          }
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] == 0)
        printf(".");
      else {
        if (mp[a[i][j]])
          putchar(mp[a[i][j]]);
        else {
          set<char> st;
          for (int x : diff[a[i][j]]) {
            st.insert(mp[x]);
          }
          for (char c = 'a';; ++c) {
            if (!st.count(c)) {
              mp[a[i][j]] = c;
              break;
            }
          }
          putchar(mp[a[i][j]]);
        }
      }
    }
    puts("");
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%s", s[i] + 1);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (s[i][j] == 'w') ++w;
      if (s[i][j] == 'b') ++b;
    }
  }
  bool ok = 1;
  if (b * 2 != w) {
    ok = 0;
  }
  queue<pair<int, int> > q;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (s[i][j] == 'b') {
        int c = 0;
        if (hori(i, j)) ++c;
        if (verti(i, j)) ++c;
        cnt[i][j] = c;
        if (cnt[i][j] == 0) ok = 0;
        if (cnt[i][j] == 1) q.push(make_pair(i, j));
      }
    }
  }
  int stamp = 1;
  while (!q.empty()) {
    auto t = q.front();
    q.pop();
    int i = t.first, j = t.second;
    if (a[i][j]) continue;
    vector<pair<int, int> > v;
    if (hori(i, j)) {
      v = {make_pair(i - 1, j), make_pair(i, j), make_pair(i + 1, j)};
    }
    if (verti(i, j)) {
      v = {make_pair(i, j - 1), make_pair(i, j), make_pair(i, j + 1)};
    }
    draw(v, stamp);
    go(v, q);
    ++stamp;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j)
      if (s[i][j] != '.') {
        if (!a[i][j]) {
          ok = 0;
        }
      }
  }
  if (ok) {
    print();
  } else {
    puts("NO");
  }
  return 0;
}
