#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define FOR(i,x,y) for(int i=x; i<=y; i++)
using namespace std;
void cepi(bool k)
{
//	#ifndef ONLINE_JUDGE
	if(k)freopen("input.txt", "r", stdin);
//	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);
}
int n,m,br;
char a[12][12];
int main()
{
  cepi(0);
  cin>>n>>m;
	FOR(i,1,n)FOR(j,1,m)
	{
		cin>>a[i][j];
		if(a[i][j]=='.'){br++;}
	}
	if(br==n*m)
	{
		if(n==m)
		{
			FOR(i,1,n)
			{
				FOR(j,1,m)if(i==j) cout<<'C'; else cout<<'.';
				cout<<endl;
			}
		}
		else
		{
			cout<<"-1";
		}
	}
	else
	{
		cout<<"-1";
	}


	return 0;
}