using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication26
{
    class Program
    {
        static void Main(string[] args)
        {
            string un = Console.ReadLine();
            int n = int.Parse(un.Split()[0]);
            int m = int.Parse(un.Split()[1]);
            char[,] matr = new char[n, m];
            for(int i=0;i<n;i++)
            {
                string linija = Console.ReadLine();
                for(int j=0;j<m;j++)
                {
                    matr[i, j] = linija[j];
                }
            }
            bool provera = true;
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    if (matr[i, j] != '.')
                        provera = false;
                }
            }
            if(provera==true && !(n==1 || m==1))
            {
                Console.WriteLine(-1);
            }
            else if (provera == true && (n == 1 || m == 1))
            {
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        if (i == j)
                            Console.Write('C');
                        else
                            Console.Write('.');
                    }
                    Console.WriteLine();
                }
            }

        }
    }
}