#include <bits/stdc++.h>
using namespace std;
char arr[1000][1000];
bool dakhal[1000][1000] = {};
int a, b;
void solv(int c, int d, char z) {
  if (c >= 0 && c < a && d >= 0 && d < b && arr[c][d] == '.') {
    arr[c][d] = z;
    if (z == 'W') {
      z = 'B';
    } else {
      z = 'W';
    }
    dakhal[c][d] = true;
    solv(c + 1, d, z);
    solv(c - 1, d, z);
    solv(c, d + 1, z);
    solv(c, d - 1, z);
  } else {
    return;
  }
}
int main() {
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      cin >> arr[i][j];
    }
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      if (!dakhal[i][j]) {
        solv(i, j, 'B');
      }
    }
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      cout << arr[i][j];
    }
    cout << endl;
  }
  return 0;
}
