import java.io.*;
import java.util.*;


public class Main_yukicoder455 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int h = sc.nextInt();
		int w = sc.nextInt();

		char[][] s = new char[h][];
		for (int i = 0; i < h; i++) {
			s[i] = sc.next().toCharArray();
		}

		Set<Integer> hsx = new HashSet<>();
		Set<Integer> hsy = new HashSet<>();
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (s[i][j] == '*') {
					hsx.add(j);
					hsy.add(i);
				}
			}
		}

		List<Integer> alx = new ArrayList<>(hsx);
		List<Integer> aly = new ArrayList<>(hsy);

		if (alx.size() == 2 && aly.size() == 2) {
			s[aly.get(0)][alx.get(0)] = '*';
			s[aly.get(0)][alx.get(1)] = '*';
		} else if (alx.size() == 2 && aly.size() == 1) {
			int y = aly.get(0) + 1;
			if (y >= h) {
				y -= 2;
			}
			s[y][alx.get(0)] = '*';
		} else if (alx.size() == 1 && aly.size() == 2) {
			int x = alx.get(0) + 1;
			if (x >= w) {
				x -= 2;
			}
			s[aly.get(0)][x] = '*';
		}

		for (int i = 0; i < h; i++) {
			pr.println(s[i]);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}