program project1;

type matrix = array[1..10,1..10] of ansistring;

var i, j, m, n, x: longint;
  s: ansistring;
  p: boolean;
  a: matrix;

function min(a,b:longint):longint;
begin
  if a<b then min:=a else min:=b;
end;

begin
  read(n);
  readln(m);
  x:=0;
  for i:=1 to n do begin
    readln(s);
    for j:=1 to m do a[i,j]:=copy(s,j,1);
  end;
  p:=true;
  for i:=1 to n do for j:=1 to m do if a[i,j]<>'.' then begin
    p:=false;
    break;
  end;
  if p then for i:=1 to min(m,n) do a[i,i]:='C'
  else x:=-1;
  if x=-1 then writeln(x) else
  for i:=1 to n do begin
    for j:=1 to m do write(a[i,j]);
    writeln();
  end;
end.