using System;

namespace harmadikFeladatMaodikFordulo
{
    class Program
    {
        static void Main(string[] args)
        {
            string x = Console.ReadLine();
            string[] x2 = x.Split(' ');
            int a = Convert.ToInt32(x2[0]);
            int b = Convert.ToInt32(x2[1]);
            string[] tomb = new string[a];
            for (int i = 0; i != a; i++)
                tomb[i] = Console.ReadLine();

            bool c = true;

            for(int i = 0;i!=a;i++)
                for(int j = 0; j != b; j++)
                {
                    if (tomb[i][j] != '.') c = false;
                }

            if (c)
            {
                for (int i = 0; i != a; i++)
                {
                    for (int j = 0; j != b; j++)
                    {
                            if (i != j) { Console.Write("."); } else { Console.Write("C"); }
                    }
                    Console.WriteLine();
                }
            }
            else
            {
                Console.WriteLine("-1");
            }
        }
    }
}