#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
int add(int a, int b) {
  if ((a += b) >= P) a -= P;
  return a;
}
int sub(int a, int b) {
  if ((a -= b) < 0) a += P;
  return a;
}
int mul(int a, int b) { return 1ll * a * b % P; }
int kpow(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = mul(a, a)) {
    if (b & 1) r = mul(r, a);
  }
  return r;
}
const int N = 1010;
int n, m, tim;
int res[N][N];
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
vector<pair<int, int> > q;
bool vis[N][N];
char s[N][N];
bool check(int i, int j, char c) {
  return 1 <= i && i <= n && 1 <= j && j <= m && s[i][j] == c && !res[i][j];
}
int calc(int i, int j) {
  if (s[i][j] == 'w') {
    int c1 = check(i - 1, j, 'b') + check(i - 2, j, 'w');
    int c2 = check(i + 1, j, 'b') + check(i + 2, j, 'w');
    int c3 = check(i, j - 1, 'b') + check(i, j - 2, 'w');
    int c4 = check(i, j + 1, 'b') + check(i, j + 2, 'w');
    return (c1 == 2) + (c2 == 2) + (c3 == 2) + (c4 == 2);
  } else {
    int c1 = check(i - 1, j, 'w') + check(i + 1, j, 'w');
    int c2 = check(i, j - 1, 'w') + check(i, j + 1, 'w');
    return (c1 == 2) + (c2 == 2);
  }
}
bool gao(int i1, int j1, char c1, int i2, int j2, char c2, int i0 = 0,
         int j0 = 0) {
  if (!check(i1, j1, c1) || !check(i2, j2, c2)) return 0;
  bool mex[5] = {0};
  if (i0) i1 = i0, j1 = j0;
  if (i1 > i2) swap(i1, i2);
  if (j1 > j2) swap(j1, j2);
  ++tim;
  for (int i = (i1); i < (i2 + 1); i++)
    for (int j = (j1); j < (j2 + 1); j++) res[i][j] = tim;
  for (int i = (i1); i < (i2 + 1); i++)
    for (int j = (j1); j < (j2 + 1); j++)
      for (int k = (0); k < (4); k++)
        for (int c = (1); c < (3); c++) {
          int x = i + dx[k] * c;
          int y = j + dy[k] * c;
          if (1 <= x && x <= n && 1 <= y && y <= m && !vis[x][y] &&
              !res[x][y] && calc(x, y) == 1) {
            vis[x][y] = 1;
            q.push_back(make_pair(x, y));
          }
        }
  return 1;
}
void Set(int i, int j) {
  if (s[i][j] == 'w') {
    if (gao(i - 1, j, 'b', i - 2, j, 'w', i, j)) return;
    if (gao(i + 1, j, 'b', i + 2, j, 'w', i, j)) return;
    if (gao(i, j - 1, 'b', i, j - 2, 'w', i, j)) return;
    if (gao(i, j + 1, 'b', i, j + 2, 'w', i, j)) return;
  } else {
    if (gao(i - 1, j, 'w', i + 1, j, 'w')) return;
    if (gao(i, j - 1, 'w', i, j + 1, 'w')) return;
  }
}
bool solve() {
  for (int i = (1); i < (n + 1); i++)
    for (int j = (1); j < (m + 1); j++) {
      if (s[i][j] == '.') {
        vis[i][j] = 1;
      } else {
        int t = calc(i, j);
        if (t == 1) {
          q.push_back(make_pair(i, j));
          vis[i][j] = 1;
        } else if (t == 0) {
          return 0;
        }
      }
    }
  for (int i = (0); i < ((int)q.size()); i++) {
    int x = q[i].first, y = q[i].second;
    if (res[x][y]) continue;
    int t = calc(x, y);
    if (t == 0) return 0;
    Set(x, y);
  }
  return 1;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n >> m;
  for (int i = (1); i < (n + 1); i++) cin >> (s[i] + 1);
  tim = 4;
  if (solve()) {
    cout << "YES"
         << "\n";
    for (int i = (1); i < (n + 1); i++)
      for (int j = (1); j < (m + 1); j++)
        if (res[i][j] > 4) {
          int i1 = i, i2 = i, j1 = j, j2 = j;
          if (res[i][j] == res[i + 1][j])
            i2 = i + 2;
          else
            j2 = j + 2;
          bool mex[5] = {0};
          for (int x = (i1); x < (i2 + 1); x++)
            for (int y = (j1); y < (j2 + 1); y++)
              for (int k = (0); k < (4); k++) {
                int nx = x + dx[k], ny = y + dy[k];
                if (1 <= nx && nx <= n && 1 <= ny && ny <= m &&
                    res[nx][ny] <= 4)
                  mex[res[nx][ny]] = 1;
              }
          for (int k = (1); k < (5); k++)
            if (!mex[k]) {
              for (int x = (i1); x < (i2 + 1); x++)
                for (int y = (j1); y < (j2 + 1); y++) res[x][y] = k;
              break;
            }
        }
    for (int i = (1); i < (n + 1); i++) {
      for (int j = (1); j < (m + 1); j++)
        cout << (res[i][j] ? (char)('a' + res[i][j] - 1) : '.');
      cout << "\n";
    }
  } else {
    cout << "NO"
         << "\n";
  }
  return 0;
}
