#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long x[] = {1, 0, -1, 0};
long long y[] = {0, -1, 0, 1};
long long vis[101][101];
char c[101][101];
bool isok(long long x, long long y) {
  if (x < 0 || x >= n || y < 0 || y >= m) return false;
  return true;
}
void bfs(long long q, long long w) {
  queue<pair<long long, long long> > zx;
  zx.push(make_pair(q, w));
  c[q][w] = 'B';
  vis[q][w] = 1;
  while (!zx.empty()) {
    pair<long long, long long> f = zx.front();
    zx.pop();
    long long xx = f.first;
    long long yy = f.second;
    for (long long i = 0; i < 4; ++i) {
      long long qq = xx + x[i];
      long long ww = yy + y[i];
      if (!vis[qq][ww] && isok(qq, ww) && c[qq][ww] == '.') {
        zx.push(make_pair(qq, ww));
        if (c[xx][yy] == 'B')
          c[qq][ww] = 'W';
        else
          c[qq][ww] = 'B';
      }
    }
  }
}
int main() {
  memset(vis, 0, sizeof(vis));
  cin >> n >> m;
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      cin >> c[i][j];
    }
  }
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      if (!vis[i][j] && c[i][j] == '.') {
        bfs(i, j);
      }
    }
  }
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      cout << c[i][j];
    }
    cout << endl;
  }
  cout << endl;
  return 0;
}
