#include <bits/stdc++.h>
using namespace std;
int a[105][105];
bool visited[105][105];
int ans[105][105];
int n, m;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
void dfs(int x, int y, int k) {
  visited[x][y] = true;
  ans[x][y] = k;
  for (int i = 0; i < 4; i++) {
    int row = x + dx[i];
    int column = y + dy[i];
    if (row >= 0 && row < n && column >= 0 && column < m) {
      if (visited[row][column] == false && a[row][column] == 1) {
        if (ans[x][y] == 3) {
          dfs(row, column, 4);
        } else {
          dfs(row, column, 3);
        }
      }
    }
  }
}
int main() {
  cin >> n >> m;
  queue<pair<int, int> > q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      if (c == '.') {
        a[i][j] = 1;
        q.push({i, j});
      } else {
        a[i][j] = 0;
      }
    }
  }
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    int x = p.first;
    int y = p.second;
    if (visited[x][y] == false) {
      dfs(x, y, 3);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (ans[i][j] == 3)
        cout << 'W';
      else if (ans[i][j] == 4)
        cout << 'B';
      else
        cout << '-';
    }
    cout << endl;
  }
  return 0;
}
