#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <set>
#include <algorithm>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
char g[110][110];
int dx[] = {-1,0,1,0};
int dy[] = {0,1,0,-1};
int n, m;
void dfs(char c, int x, int y) {
g[x][y] = c;
for(int i = 0; i < 4; ++i) {
int xx = x + dx[i];
int yy = y + dy[i];
char tmp = (c == 'B' ? 'W' : 'B');
if(g[xx][yy] != '.')
continue;
if(xx < 0 || yy < 0 || xx > n || yy > m)
continue;
dfs(tmp, xx, yy);
}
}
int main() {
cin >> n >> m;
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++j) {
cin >> g[i][j];
}
}
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++j) {
if(g[i][j] == '.') {
dfs('B', i, j);
}
}
}
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++j) {
cout << g[i][j];
}
cout << endl;
}
return 0;
}