#include <bits/stdc++.h>
using namespace std;
const int N = 1011;
int n, m;
char a[N][N];
int b[N][N], ts;
const int dx[] = {-1, -1, 0, 0, 1, 1};
const int dy[] = {1, -1, 2, -2, 1, -1};
void output() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int x = i, y = j;
      if (a[i][j] == '.') {
        printf(".");
        continue;
      }
      if (a[i][j] == '<')
        ++y;
      else if (a[i][j] == '>')
        --y;
      else if (a[i][j] == 'A')
        ++x;
      else if (a[i][j] == 'V')
        --x;
      else if (a[i][j] != '-' && a[i][j] != '|') {
        printf("%c", a[i][j]);
        continue;
      }
      char k = 'a';
      if (x % 2 == 1) k = 'c';
      if (x / 2 % 2 != y / 2 % 2) ++k;
      putchar(k);
    }
    puts("");
  }
}
bool dfs(int x, int y) {
  b[x][y] = ts;
  if (x > 0 && x < n - 1 && a[x - 1][y] == 'w' && a[x + 1][y] == 'w') {
    a[x - 1][y] = 'A';
    a[x][y] = '|';
    a[x + 1][y] = 'V';
    int nc = 0;
    for (int d = 0; d < 6; ++d) {
      int nx = x + dy[d];
      int ny = y + dx[d];
      if (nx >= 0 && nx < n && ny >= 0 && ny < m && a[nx][ny] == 'b') {
        ++nc;
        if (dfs(nx, ny))
          return true;
        else
          break;
      }
    }
    if (!nc) return true;
    a[x - 1][y] = 'w';
    a[x][y] = 'b';
    a[x + 1][y] = 'w';
  }
  if (y > 0 && y < m - 1 && a[x][y - 1] == 'w' && a[x][y + 1] == 'w') {
    a[x][y - 1] = '<';
    a[x][y] = '-';
    a[x][y + 1] = '>';
    int nc = 0;
    for (int d = 0; d < 6; ++d) {
      int nx = x + dx[d];
      int ny = y + dy[d];
      if (nx >= 0 && nx < n && ny >= 0 && ny < m && a[nx][ny] == 'b') {
        ++nc;
        if (dfs(nx, ny))
          return true;
        else
          break;
      }
    }
    if (!nc) return true;
    a[x][y - 1] = 'w';
    a[x][y] = 'b';
    a[x][y + 1] = 'w';
  }
  return false;
}
int main() {
  scanf("%d%d\n", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%s", a[i]);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      if (a[i][j] == 'b') {
        ts = i * m + j + 1;
        if (!dfs(i, j)) {
          puts("NO");
          return 0;
        }
      }
    }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (a[i][j] == 'b' || a[i][j] == 'w') {
        puts("NO");
        return 0;
      }
  puts("YES");
  output();
}
