#include <cstdio>
const int N=505;
char a[N][N],b[N][N];
int main (){
	int n,m;scanf ("%d%d",&n,&m);
	for (int i=1;i<=n;i++) scanf ("%s",a[i]+1);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			b[i][j]=a[i][j];
	for (int i=1;i<=n;i+=2)
		for (int j=1;j<m;j++)
			a[i][j]='#';
	for (int i=2;i<=n;i+=2)
		for (int j=2;j<=m;j++)
			b[i][j]='#';
	for (int i=1;i<=n;i++) a[i][1]='#';
	for (int i=1;i<=n;i++) b[i][m]='#';
	for (int i=1;i<=n;i++,puts(""))
		for (int j=1;j<=m;j++)
			printf ("%c",a[i][j]);
	puts("");
	for (int i=1;i<=n;i++,puts(""))
		for (int j=1;j<=m;j++)
			printf ("%c",b[i][j]);
	return 0;
}