#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
int add(int a, int b) {
  if ((a += b) >= P) a -= P;
  return a;
}
int sub(int a, int b) {
  if ((a -= b) < 0) a += P;
  return a;
}
int mul(int a, int b) { return 1ll * a * b % P; }
int kpow(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = mul(a, a)) {
    if (b & 1) r = mul(r, a);
  }
  return r;
}
const int N = 2005;
int xx, yy, dx[] = {0, 0, -1, -1}, dy[] = {0, -1, 0, -1};
int n, x, y, ok, m;
string s[N];
queue<pair<int, int> > q;
bool cal(pair<int, int> t) {
  if (t.first < 1 || t.first + 1 > n || t.second < 1 || t.second + 1 > m)
    return 0;
  int c1 = 0;
  for (int i = (0); i < (4); i++) {
    x = t.first - dx[i];
    y = t.second - dy[i];
    if (s[x][y] == '*') c1++, xx = x, yy = y;
  }
  if (c1 == 1) s[xx][yy] = '.';
  return c1 == 1;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n >> m;
  for (int i = (1); i < (n + 1); i++) {
    cin >> s[i];
    s[i] = " " + s[i];
  }
  for (int i = (1); i < (n + 1); i++)
    for (int j = (1); j < (m + 1); j++) {
      q.push(make_pair(i, j));
    }
  while (!q.empty()) {
    pair<int, int> t = q.front();
    ok = cal(t);
    q.pop();
    if (ok) {
      for (int i = (0); i < (4); i++) {
        x = xx + dx[i];
        y = yy + dy[i];
        q.push(make_pair(x, y));
      }
    }
  }
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (1); j < (m + 1); j++) cout << s[i][j];
    cout << "\n";
  }
  return 0;
}
