#include <bits/stdc++.h>
using namespace std;
int n, m;
string s[2005];
int mov[][8] = {{0, 1, 0, -1, 1, 1, -1, -1}, {1, 0, -1, 0, -1, 1, -1, 1}};
bool checkSq(int i, int j) {
  if (i < 0 || j < 0 || i + 1 >= n || j + 1 >= m) return 0;
  int dot = 0;
  for (int k = 0; k < 2; k++)
    for (int l = 0; l < 2; l++)
      if (s[i + k][j + l] == '.') dot++;
  return (dot == 3);
}
bool check(pair<int, int> p) {
  bool g = checkSq(p.first - 1, p.second - 1);
  g = g || checkSq(p.first - 1, p.second);
  g = g || checkSq(p.first, p.second - 1);
  g = g || checkSq(p.first, p.second);
  return g;
}
bool valid(int i, int j) {
  return (i >= 0 && j >= 0 && i < n && j < m && s[i][j] == '*');
}
void bfs() {
  queue<pair<int, int> > cola;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (s[i][j] == '*') cola.push(make_pair(i, j));
  pair<int, int> cur;
  while (!cola.empty()) {
    cur = cola.front();
    cola.pop();
    if (s[cur.first][cur.second] == '.') continue;
    if (check(cur)) {
      s[cur.first][cur.second] = '.';
      for (int i = 0; i < 8; i++) {
        int ni = cur.first + mov[0][i], nj = cur.second + mov[1][i];
        if (valid(ni, nj)) cola.push(make_pair(ni, nj));
      }
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> s[i];
  bfs();
  for (int i = 0; i < n; i++) cout << s[i] << endl;
  return 0;
}
