#include <bits/stdc++.h>
using namespace std;
char mp[105][105];
int n, m;
bool in(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; }
void dfs(int x, int y, char c) {
  char cc;
  if (!in(x, y) || mp[x][y] != '.') return;
  if (c == 'W') {
    mp[x][y] = 'B';
    cc = 'B';
  } else {
    mp[x][y] = 'W';
    cc = 'W';
  }
  dfs(x + 1, y, cc);
  dfs(x - 1, y, cc);
  dfs(x, y + 1, cc);
  dfs(x, y - 1, cc);
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 0; i < n; i++) scanf(" %s", mp[i]);
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) {
        if (mp[i][j] == '.') dfs(i, j, 'W');
      }
    for (int i = 0; i < n; i++) printf("%s\n", mp[i]);
  }
  return 0;
}
