#include <iostream>
using namespace std;
int main() {
	int a, b;
	char  k[505][505];
	cin >> a >> b;
	for (int i = 0; i < a; ++i) {
		for (int j = 0; j < b; ++j) {
			cin >> k[i][j];
		}
	}

	//red
	for (int i = 0; i < a; ++i) {
		for (int j = 0; j < b; ++j) {
			if (i % 2 == 1&&j!=b-1) cout << "#";
			else if (j == 0) cout << "#";
			else if (k[i][j] == '#') cout << "#";
			else cout << ".";
		}
		cout << endl;
	}
	cout << endl;
	//blue
	for (int i = 0; i < a; ++i) {
		for (int j = 0; j < b; ++j) {
			if (i % 2 == 0&&j!=0) cout << "#";
			else if (j == b - 1) cout << "#";
			else if (k[i][j] == '#') cout << "#";
			else cout << ".";
		}
		cout << endl;
	}
}