#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int MAXN = 2005;
int n, m;
char maze[MAXN][MAXN];
void Dfs(int x, int y) {
  if (x >= n - 1 || y >= m - 1 || x < 0 || y < 0) return;
  int xx, yy, s = 0;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j)
      if (maze[x + i][y + j] == '*') {
        s++;
        xx = x + i;
        yy = y + j;
      }
  if (s == 1) {
    maze[xx][yy] = '.';
    for (int i = -1; i < 1; ++i)
      for (int j = -1; j < 1; ++j) Dfs(xx + i, yy + j);
  }
}
int main(int argc, char const *argv[]) {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%s", maze[i]);
  for (int i = 0; i < n - 1; ++i)
    for (int j = 0; j < m - 1; ++j) Dfs(i, j);
  for (int i = 0; i < n; ++i) printf("%s\n", maze[i]);
  return 0;
}
