#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
int n,m,a[510][510],b[510][510];char ch;
int main(){
	scanf("%d%d",&n,&m);
	rep(i,1,n) rep(j,1,m) scanf(" %c",&ch),a[i][j]=b[i][j]=(ch=='#');
	rep(i,2,n-1) rep(j,2,m-1) (j&1)?(a[i][j]=1):(b[i][j]=1);
	rep(i,1,m) a[1][i]=b[n][i]=1;
	rep(i,1,n){rep(j,1,m) putchar(a[i][j]?'#':'.');puts("");}puts("");
	rep(i,1,n){rep(j,1,m) putchar(b[i][j]?'#':'.');puts("");}
	return 0;
}