#include <bits/stdc++.h>
using namespace std;
vector <int> broj;
vector <pair <int, int>> polje;
char a[11][11];
int b[11][11];
int n, m, s = 0;
void Povecaj(vector <int> &broj)
{
    int i = broj.size() - 1;
    while(broj[i] == 1)
    {
        broj[i] = 0;
        s--;
        i--;
    }
    broj[i] = 1;
    s++;
}
bool Proveri(vector <int> &broj)
    {
        int i, j, u, d, l, r;
        for(i = 1; i <= n; i++)
            for(j = 1; j <= m; j++)
            {
                b[i][j] = 1;
                if((a[i][j] >= '0' && a[i][j] <= '5') || a[i][j] == '#')b[i][j] = 0;
            }
        for(i = 0; i < (int)broj.size(); i++)
        {
            if(broj[i] == 1)
            {
                if(b[polje[i].first][polje[i].second] == 0)return 0;
                b[polje[i].first][polje[i].second] = 20;
                u = polje[i].first - 1;
                d = polje[i].first + 1;
                l = polje[i].second - 1;
                r = polje[i].second + 1;
                while(u > 0 && a[u][polje[i].second] == '.')
                {
                    b[u][polje[i].second] = 0;
                    u--;
                }
                while(d <= m && a[d][polje[i].second] == '.')
                {
                    b[d][polje[i].second] = 0;
                    d++;
                }
                while(l > 0 && a[polje[i].first][l] == '.')
                {
                    b[polje[i].first][l] = 0;
                    l--;
                }
                while(r <= n && a[polje[i].first][r] == '.')
                {
                    b[polje[i].first][r] = 0;
                    r++;
                }
            }
        }
        for(i = 1; i <= n; i++)
            for(j = 1; j <= m; j++)
            {
                if(a[i][j] == '0' && b[i - 1][j] + b[i + 1][j] + b[i][j - 1] + b[i][j + 1] != 0)return 0;
                if(a[i][j] == '1' && b[i - 1][j] + b[i + 1][j] + b[i][j - 1] + b[i][j + 1] != 20)return 0;
                if(a[i][j] == '2' && b[i - 1][j] + b[i + 1][j] + b[i][j - 1] + b[i][j + 1] != 40)return 0;
                if(a[i][j] == '3' && b[i - 1][j] + b[i + 1][j] + b[i][j - 1] + b[i][j + 1] != 60)return 0;
                if(a[i][j] == '4' && b[i - 1][j] + b[i + 1][j] + b[i][j - 1] + b[i][j + 1] != 80)return 0;
                if(b[i][j] == 1)return 0;
            }
        return 1;
    }
int main()
{
    int i, j;
    cin >> n >> m;
    for(i = 1; i <= n; i++)
        for(j = 1; j <= m; j++)
        {
            cin >> a[i][j];
            if(a[i][j] == '.')
            {
                polje.push_back(make_pair(i, j));
                broj.push_back(0);
            }
        }
    while(Proveri(broj) == 0)
    {
        if(s == (int)broj.size()){cout << "-1"; return 0;}
        Povecaj(broj);
    }
    for(i = 1; i <= n; i++)
    {
        for(j = 1; j <= m; j++)
            if(b[i][j] == 20)cout << "C";
                else cout << a[i][j];
        cout << endl;
    }
    return 0;
}