#include <iostream>

using namespace std;

int main()
{int i, j, k, n, m, nm, nt, np, nk[5]={0};
 char ch, ct, cp, c[5], **mat, pro[3][3];
 ct='.';cp='#';//vrste karaktera
 for(i=0;i<5;i++) c[i]='0'+i;
 nt=0;np=0;
 cin >>n>>m;
 nm=n*m;
 mat = new char* [n+1];
 for(i=0;i<=n;i++) mat[i]=new char[m+1];

 for(i=1;i<=n;i++)
   for(k=1;k<=m;k++)
     { cin>>ch;
       mat[i][k]=ch;
       if(ch==ct) nt++;//prebrojava karaktere
       else if (ch==cp) np++;
       else nk[ch-'0']++;
     }
 if(nt == nm)//ako su sva polja prazna
  { for(i=1;i<=n;i++) mat[i][i]='C';
    for(i=1;i<=n;i++)
       { if(i>1) cout<<"\n";
         for(k=1;k<=m;k++) cout<<mat[i][k];
       }
  }
 else cout<<-1;

 for(i=0;i<=n;i++) delete []mat[i];
 delete []mat;
 return 0;
}