#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int M = 2e3 + 5, INF = 0x3f3f3f3f, mod = 1e8 + 7;
char mp[M][M];
int n, m;
int rx[] = {0, 1, 0, -1};
int ry[] = {1, 0, -1, 0};
void dfs(int x, int y) {
  if (x <= 0 || x >= n || y <= 0 || y >= m) return;
  int cnt = 0;
  int x1, y1;
  for (int j = 0; j < 2; j++) {
    for (int k = 0; k < 2; k++) {
      if (mp[x + j][y + k] == '*') {
        cnt++;
        x1 = x + j;
        y1 = y + k;
      }
    }
  }
  if (cnt == 1) {
    mp[x1][y1] = '.';
    for (int j = -1; j < 1; j++) {
      for (int k = -1; k < 1; k++) {
        dfs(x1 + j, y1 + k);
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int j = 1; j <= n; j++) {
    scanf("%s", mp[j] + 1);
  }
  for (int j = 1; j <= n; j++) {
    for (int k = 1; k <= m; k++) {
      dfs(j, k);
    }
  }
  for (int j = 1; j <= n; j++) printf("%s\n", mp[j] + 1);
  return 0;
}
