#include<bits/stdc++.h>
using namespace std;
int n, m;
char s[1111][1111];
int main(){
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
	scanf("%s", s[i] + 1);
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(i == 1) {printf("#"); continue;}
			if(i == n) {printf("."); continue;}
			if(j % 2 == 1){printf("#"); continue;}
			if(s[i][j] == '#'){printf("#"); continue;}
			printf(".");
		}
		puts("");
	}
	puts("");
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(i == n) {printf("#"); continue;}
			if(i == 1) {printf("."); continue;}
			if(j % 2 == 0){printf("#"); continue;}
			if(s[i][j] == '#'){printf("#"); continue;}
			printf(".");
		}
		puts("");
	}
} 