#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 62;
const int mods = 998244353;
const int MAXN = 3005;
const int INF = 0x3f3f3f3f;
inline int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
char st[MAXN];
int flag[MAXN][MAXN], n, m;
int dx1[4] = {1, 0, -1, -1}, dy1[4] = {0, -1, 0, -1};
int dx2[4] = {0, 1, -1, -1}, dy2[4] = {1, -1, 1, 0};
int dx3[4] = {1, 1, 0, 0}, dy3[4] = {1, 0, 1, -1};
void solve(int x, int y) {
  if (x < 1 || y < 1 || x > n || y > m || flag[x][y]) return;
  for (int i = 0; i < 4; i++) {
    int x1 = x + dx1[i], y1 = y + dy1[i];
    int x2 = x + dx2[i], y2 = y + dy2[i];
    int x3 = x + dx3[i], y3 = y + dy3[i];
    if (flag[x1][y1] && flag[x2][y2] && flag[x3][y3]) {
      flag[x][y] = 1;
      for (int p = x - 1; p <= x + 1; p++)
        for (int q = y - 1; q <= y + 1; q++) solve(p, q);
      break;
    }
  }
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) {
    scanf("%s", st + 1);
    for (int j = 1; j <= m; j++) flag[i][j] = (st[j] == '.');
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) solve(i, j);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) putchar(flag[i][j] ? '.' : '*');
    puts("");
  }
  return 0;
}
