#include <bits/stdc++.h>
using namespace std;
long long oo = 1e9 + 7;
int n, m;
char g[2008][2008];
bool check(int r, int c) {
  if (r + 1 > n) return 0;
  if (c + 1 > m) return 0;
  return 1;
}
int f(int r, int c) {
  int ret = 0;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (g[r + i][c + j] == '.') ret++;
  return ret;
}
void dfs(int r, int c) {
  if (r < 1 || c < 1) return;
  if (r > n || c > m) return;
  if (!check(r, c)) return;
  int num = f(r, c);
  if (num == 3) {
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++)
        if (g[i + r][j + c] == '*') g[i + r][j + c] = '.';
    dfs(r - 1, c);
    dfs(r, c - 1);
    dfs(r - 1, c - 1);
    dfs(r - 1, c + 1);
    dfs(r, c + 1);
    dfs(r + 1, c + 1);
    dfs(r + 1, c);
    dfs(r + 1, c - 1);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", g[i] + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) dfs(i, j);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%c", g[i][j]);
    printf("\n");
  }
}
