#include<cstdio>//AT2043
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdlib>

using namespace std;

int n,m;

char ch[2]={'.','#'};

char ch2[2]={' ','\n'};

int red[502][502],blue[502][502];

char purple[502][502];

int main(){
    scanf("%d%d",&n,&m);
    scanf("\n");
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            scanf("%c",&purple[i][j]);
        }
        if(i<n){
            scanf("\n");
        }
    }
    for(int i=1;i<=n;i++){
        if(i%2){
            for(int j=1;j<m;j++){
                red[i][j]=1;
            }
            blue[i][m]=1;
        }
        else{
            for(int j=2;j<=m;j++){
                blue[i][j]=1;
            }
            red[i][1]=1;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(red[i][j]==0&&purple[i][j]==ch[1]){
                red[i][j]=1;
            }
            if(blue[i][j]==0&&purple[i][j]==ch[1]){
                blue[i][j]=1;
            }
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            printf("%c",red[i][j]?ch[1]:ch[0]);
        }
        printf("\n");
    }
    printf("\n");
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            printf("%c",blue[i][j]?ch[1]:ch[0]);
        }
        printf("\n");
    }
    return 0;
}
