#include<bits/stdc++.h>
using namespace std;
#define N 1116

int n,m;
char s[N][N];

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();m=read();
	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++)
			printf((j==1||(j!=m&&i%2==1)||s[i][j]=='#')?"#":".");
		printf("\n");
	}
	printf("\n");
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++)
			printf((j==m||(j!=1&&i%2==0)||s[i][j]=='#')?"#":".");
		printf("\n");
	}
	return 0;
}