#include <bits/stdc++.h>
char a[105][105];
int vis[105][105];
int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
int n, m;
void dfs(int x, int y) {
  if (vis[x][y] || a[x][y] == '-') return;
  vis[x][y] = 1;
  for (int i = 0; i < 4; i++) {
    int xx = x + dir[i][0];
    int yy = y + dir[i][1];
    if (!vis[xx][yy] && xx >= 1 && xx <= n && yy >= 1 && yy <= m) {
      if (a[x][y] == 'W')
        a[xx][yy] = 'B';
      else if (a[x][y] == 'B')
        a[xx][yy] = 'W';
      dfs(xx, yy);
    }
  }
}
int main() {
  while (~scanf("%d%d%*c", &n, &m)) {
    memset(a, '-', sizeof(a));
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        scanf("%c", &a[i][j]);
        if (a[i][j] == '-') vis[i][j] = 1;
      }
      getchar();
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (a[i][j] == '.' && !vis[i][j]) {
          a[i][j] = 'B';
          dfs(i, j);
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        printf("%c", a[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
