#include <bits/stdc++.h>
using namespace std;

#define rep(i, begin, end) for (int i = (begin); i < (end); i++)

bool b[1000][1000], r[1000][1000];
int n, m;

int main() {
    cin >> n >> m;
    rep(i,0,n) rep(j,0,m) {
        if (j == 0 || (i%2 && j != m-1)) b[i][j] = 1;
        if (j == m-1 || (i%2==0 && j != 0)) r[i][j] = 1;
        char ch;
        cin >> ch;
        if (ch == '#') r[i][j] = b[i][j] = 1;
    }
    rep(i,0,n) {
        rep(j,0,m) cout << (r[i][j] ? '#' : '.');
        cout << '\n';
    }
    cout << '\n';
    rep(i,0,n) {
        rep(j,0,m) cout << (b[i][j] ? '#' : '.');
        cout << '\n';
    }
    
}