#include <bits/stdc++.h>
using namespace std;
char board[5000][105];
bool next(int *x, int *y, int n, int m) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (board[i][j] == '.') {
        *x = i;
        *y = j;
        return true;
      }
    }
  }
  return false;
}
struct node {
  int x, y;
};
queue<struct node> l;
void test(int x, int y, int n, int m, char c) {
  if (x < 0 || x == n || y < 0 || y == m) return;
  if (board[x][y] != '.') return;
  if (c == 'B')
    board[x][y] = 'W';
  else
    board[x][y] = 'B';
  struct node nn;
  nn.x = x;
  nn.y = y;
  l.push(nn);
}
void dol(int n, int m) {
  int x, y;
  while (!l.empty()) {
    struct node *nn = &l.front();
    l.pop();
    x = nn->x;
    y = nn->y;
    test(x - 1, y, n, m, board[x][y]);
    test(x + 1, y, n, m, board[x][y]);
    test(x, y - 1, n, m, board[x][y]);
    test(x, y + 1, n, m, board[x][y]);
  }
}
void man(int n, int m) {
  struct node nn;
  while (next(&nn.x, &nn.y, n, m)) {
    board[nn.x][nn.y] = 'B';
    l.push(nn);
    dol(n, m);
  }
}
int main() {
  if (0) freopen("test.txt", "rb", stdin);
  int n, m;
  scanf("%d %d", &n, &m);
  getchar();
  for (int i = 0; i < n; i++) {
    fgets(board[i], 105, stdin);
    board[i][strlen(board[i]) - 1] = '\0';
  }
  man(n, m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%c", board[i][j]);
    }
    printf("\n");
  }
  if (0) fclose(stdin);
  return 0;
}
