#include <bits/stdc++.h>
using namespace std;
const int maxx = 2002;
string G[maxx];
int vis[maxx][maxx];
int n, m;
bool valid(int x, int y) { return x >= 0 and y >= 0 and x < n and y < m; }
void dfs(int x, int y) {
  if (not valid(x, y) or not valid(x + 1, y + 1) or vis[x][y]) return;
  int cross = 0;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) cross += (G[x + i][y + j] == '*');
  if (cross == 1) {
    vis[x][y] = 1;
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++)
        if (G[x + i][y + j] == '*') {
          G[x + i][y + j] = '.';
          for (int k = 0; k < 2; k++)
            for (int l = 0; l < 2; l++) dfs(x + i - k, y + j - l);
          return;
        }
  }
  return;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> G[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      dfs(i, j);
    }
  for (int i = 0; i < n; i++) cout << G[i] << endl;
  return 0;
}
