#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
int visit[105][105], n, m;
char a[105][105];
struct node {
  int x, y;
};
int judge(int i, int j) {
  int s, x, y;
  for (s = 0; s < 4; s++) {
    x = i + dx[s];
    y = j + dy[s];
    if (x < 0 || x >= n || y < 0 || y >= m) continue;
    if (a[x][y] != '-') return 0;
  }
  return 1;
}
void bfs(node s) {
  queue<node> q;
  node p, next;
  q.push(s);
  visit[s.x][s.y] = 1;
  while (q.empty() == 0) {
    p = q.front();
    q.pop();
    for (int i = 0; i < 4; i++) {
      int x1 = p.x + dx[i];
      int y1 = p.y + dy[i];
      if (x1 < 0 || x1 >= n || y1 < 0 || y1 >= m || visit[x1][y1] == 1 ||
          a[x1][y1] == '-')
        continue;
      if (a[p.x][p.y] == 'B') {
        a[x1][y1] = 'W';
        visit[x1][y1] = 1;
        next.x = x1;
        next.y = y1;
        q.push(next);
      } else if (a[p.x][p.y] == 'W') {
        a[x1][y1] = 'B';
        visit[x1][y1] = 1;
        next.x = x1;
        next.y = y1;
        q.push(next);
      }
    }
  }
}
int main(void) {
  int i, j, p;
  node s;
  while (scanf("%d %d", &n, &m) != EOF) {
    for (i = 0; i < n; i++) scanf("%s", a[i]);
    p = 0;
    memset(visit, 0, sizeof(visit));
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (a[i][j] == '.') {
          s.x = i;
          s.y = j;
          a[s.x][s.y] = 'B';
          bfs(s);
        }
      }
    }
    for (i = 0; i < n; i++) printf("%s\n", a[i]);
  }
  return 0;
}
