#include<bits/stdc++.h>
#define il inline 
#define R register int
#define ll long long
#define gc getchar
using namespace std;
il int rd()
{
    R x=0,flag=1;
	char ch=0;
    while((ch>'9'||ch<'0')&&ch!='-')ch=gc();
	if(ch=='-')flag=-1,ch=gc();
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=gc();
    return x*flag;
}
const int N=1000;
char a[N][N],b[N][N],c[N][N];
int n,m;
int main ()
{
	n=rd(),m=rd();
	for(R i=1;i<=n;i++)
		for(R j=1;j<=m;j++)
			b[i][j]=c[i][j]='.';
	
	for(R i=1;i<=n;i+=2)
		for(R j=1;j<=m;j++)
			b[i][j]='#';
	
	for(R i=1;i<=n;i++)
		b[i][1]='#';

	
	for(R i=2;i<=n;i+=2)
		for(R j=1;j<=m;j++)
			c[i][j]='#';
	
	for(R i=1;i<=n;i++)
		c[i][m]='#';
	
	for(R i=1;i<=n;i++)
		for(R j=1;j<=m;j++)
		{

			cin>>a[i][j];
			if(a[i][j]=='#')
			{
				b[i][j]='#';c[i][j]='#';
			}
		}
	for(R i=1;i<=n;i++)
	{
		for(R j=1;j<=m;j++)
			cout<<b[i][j];
		cout<<endl;
	}
	cout<<endl;
	for(R i=1;i<=n;i++)
	{
		for(R j=1;j<=m;j++)
			cout<<c[i][j];
		cout<<endl;
	}
	return 0;
}
