#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  T x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m;
char G[2005][2005];
int A[2005][2005];
struct pii {
  int x, y;
  pii(int x = 0, int y = 0) : x(x), y(y) {}
  inline bool operator==(const pii &T) const { return x == T.x && y == T.y; }
};
int wy[4][2] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}};
inline void bfs() {
  queue<pii> q;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (G[i][j] == '*')
        A[i][j] = 1;
      else
        q.push(pii(i, j));
  while (!q.empty()) {
    pii u = q.front();
    q.pop();
    int x = u.x, y = u.y;
    if (x > 1 && y > 1 && A[x - 1][y - 1] + A[x][y - 1] + A[x - 1][y] == 1) {
      if (A[x - 1][y - 1])
        q.push(pii(x - 1, y - 1)), G[x - 1][y - 1] = '.', A[x - 1][y - 1] = 0;
      if (A[x - 1][y])
        q.push(pii(x - 1, y)), G[x - 1][y] = '.', A[x - 1][y] = 0;
      if (A[x][y - 1])
        q.push(pii(x, y - 1)), G[x][y - 1] = '.', A[x][y - 1] = 0;
    }
    if (x > 1 && y < m && A[x - 1][y + 1] + A[x][y + 1] + A[x - 1][y] == 1) {
      if (A[x - 1][y + 1])
        q.push(pii(x - 1, y + 1)), G[x - 1][y + 1] = '.', A[x - 1][y + 1] = 0;
      if (A[x][y + 1])
        q.push(pii(x, y + 1)), G[x][y + 1] = '.', A[x][y + 1] = 0;
      if (A[x - 1][y])
        q.push(pii(x - 1, y)), G[x - 1][y] = '.', A[x - 1][y] = 0;
    }
    if (x < n && y > 1 && A[x + 1][y - 1] + A[x][y - 1] + A[x + 1][y] == 1) {
      if (A[x + 1][y - 1])
        q.push(pii(x + 1, y - 1)), G[x + 1][y - 1] = '.', A[x + 1][y - 1] = 0;
      if (A[x][y - 1])
        q.push(pii(x, y - 1)), G[x][y - 1] = '.', A[x][y - 1] = 0;
      if (A[x + 1][y])
        q.push(pii(x + 1, y)), G[x + 1][y] = '.', A[x + 1][y] = 0;
    }
    if (x < n && y < m && A[x + 1][y + 1] + A[x][y + 1] + A[x + 1][y] == 1) {
      if (A[x + 1][y + 1])
        q.push(pii(x + 1, y + 1)), G[x + 1][y + 1] = '.', A[x + 1][y + 1] = 0;
      if (A[x][y + 1])
        q.push(pii(x, y + 1)), G[x][y + 1] = '.', A[x][y + 1] = 0;
      if (A[x + 1][y])
        q.push(pii(x + 1, y)), G[x + 1][y] = '.', A[x + 1][y] = 0;
    }
  }
}
int main() {
  n = read<int>(), m = read<int>();
  for (int i = 1; i <= n; ++i) scanf(" %s", G[i] + 1);
  bfs();
  for (int i = 1; i <= n; ++i) printf("%s\n", G[i] + 1);
  return 0;
}
