/* 2013-08-11 10:11:44.118797 */#include<cstdio>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<string>
#include<iostream>
#include<cassert>
#include<algorithm>

using namespace std;

#define MP make_pair
#define PB push_back
#define foreach(e,x) for(__typedef(x.begin()) e=x.begin(); e!=x.end(); ++e)

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> mapII;

const int MAX_N = 1000 + 10;
const double EPS = 1e-8;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

char a[MAX_N][MAX_N];
char b[MAX_N][MAX_N];
int choose[MAX_N][MAX_N];
int N, M;

void dye(int x, int y)
{
	int usd[5];
	int nx, ny;
	for(int i = 0; i < 4; ++ i) {
		usd[i] = 0;
	}
	if (choose[x][y + 1] == choose[x][y]) {
		for(int yy = y; yy <= y + 2; ++ yy) {
			for(int i = 0; i < 4; ++ i) {
				nx = x + dx[i];
				ny = yy + dy[i];
				if (b[nx][ny] && b[nx][ny] != '.')
					usd[b[nx][ny] - 'a'] = true;
			}
		}
		int col;
		for(col = 0; col < 4; ++ col) {
			if (! usd[col]) break;
		}
		assert(col < 4);
		for(int yy = y; yy <= y + 2; ++ yy) {
			b[x][yy] = col + 'a';
		}
	} else {
		for(int xx = x; xx <= x + 2; ++ xx) {
			for(int i = 0; i < 4; ++ i) {
				nx = xx + dx[i];
				ny = y + dy[i];
				if (b[nx][ny] && b[nx][ny] != '.') {
					usd[b[nx][ny] - 'a'] = true;
				}
			}
		}
		int col;
		for(col = 0; col < 4; ++ col) {
			if (! usd[col]) break;
		}
		assert(col < 4);
		for(int xx = x; xx <= x + 2; ++ xx) {
			b[xx][y] = col + 'a';
		}
	}
}

int checkR(int x, int y)
{
	if (y + 2 >= M) return false;
	for(int yy = y; yy <= y + 2; ++ yy) {
		if (choose[x][yy] || a[x][yy] == '.')
			return false;
	}
	return a[x][y] == 'w' && a[x][y + 1] == 'b' && a[x][y + 2] == 'w';
}

int checkD(int x, int y)
{
	if(x + 2 >= N) return false;
	for(int xx = x; xx <= x + 2; ++ xx) {
		if (choose[xx][y] || a[xx][y] == '.')
			return false;
	}
	return a[x][y] == 'w' && a[x + 1][y] == 'b' && a[x + 2][y] == 'w';
}

void solve()
{
	int tot = 1;
	for(int i = 0; i < N; ++ i) {
		for(int j = 0; j < M; ++ j) {
			if (a[i][j] != '.' && ! choose[i][j]) {
				if (a[i][j] == 'b') {
					cout << "NO" << endl;
					return;
				}
				if (checkR(i, j)) {
					choose[i][j] = tot;
					choose[i][j + 1] = tot;
					choose[i][j + 2] = tot;
				} else if (checkD(i, j)) {
					choose[i][j] = tot;
					choose[i + 1][j] = tot;
					choose[i + 2][j] = tot;
				} else {
					cout << "NO" << endl;
					return;
				}
				tot ++;
			}
		}
	}
	for(int i = 0; i < N; ++ i) {
		for(int j = 0; j < M; ++ j) {
			if (! choose[i][j]) {
				b[i][j] = '.';
				continue;
			}
			if (b[i][j] == 0)
				dye(i, j);
		}
	}
	cout << "YES" << endl;
	for(int i = 0; i < N; ++ i) {
		puts(b[i]);
	}
}

int main()
{
	cin >> N >> M;
	for(int i = 0; i < N; ++ i) {
		scanf("%s", a[i]);
	}
	solve();
	return 0;
}

