#include<bits/stdc++.h>
using namespace std;
const int N=510;
char f1[N][N],f2[N][N];
int main()
{
	int n,m,i,j;cin>>n>>m;
	char c;
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++) {
			while ((c=getchar())!='#'&&c!='.');
			if (c=='#') f1[i][j]=f2[i][j]='#';
			else if (i&1) f1[i][j]='#',f2[i][j]='.';
			else f1[i][j]='.',f2[i][j]='#';
		}
	for (i=1;i<=n;i++)
		f1[i][1]=f2[i][m]='#',f1[i][m]=f2[i][1]='.';
	for (i=1;i<=n;i++) puts(f1[i]+1);
	putchar(10);
	for (i=1;i<=n;i++) puts(f2[i]+1);
	return 0;
}