{
TASK:MUSIS
LANG:PASCAL
}
program juru_musis;
  { J.K sprendimas }
  const go : array [1..4] of
               record
                 x, y : integer;
               end =
        ((x : 0; y : 1), (x : 0; y : -1), (x : 1; y : 0), (x : -1; y : 0));
  type juru_laukas = array [1..10, 1..10] of integer;
       juru_laivai = array [1..4] of integer;
  var f : text;
      i, ii : integer;
      laukas : juru_laukas;
      laivai : juru_laivai;
      c : char;
      kampu_tvarka, laivu_tvarka : boolean;
      tvarka : boolean;

  function laivas (var laukas : juru_laukas; y, x : integer) : integer;
    var nx, ny : integer;
        dydis : integer;
        i : integer;
  begin
    dydis := 1;
    laukas[y, x] := 2;
    for i := 1 to 4 do
      begin
        nx := x + go[i].x;
        ny := y + go[i].y;
        if (ny >= 1) and (ny <= 10) and
           (nx >= 1) and (nx <= 10) and (laukas[ny, nx] = 1)
          then dydis := dydis + laivas (laukas, ny, nx);
      end;
    laivas := dydis;
  end;

  function kampai (var laukas : juru_laukas) : boolean;
    var tvarka : boolean;
        i, ii : integer;
  begin
    tvarka := true;
    for i := 1 to 9 do
      for ii := 1 to 9 do
        begin
          if (laukas[i, ii] > 0) and (laukas[i + 1, ii + 1] > 0) and
             (laukas[i + 1, ii] = 0) and (laukas[i, ii + 1] = 0)
            then
              begin
                if (laukas[i, ii] = 1)
                  then
                    begin
                      tvarka := false;
                      laivas (laukas, i, ii);
                    end;
                if (laukas[i + 1, ii + 1] = 1)
                  then
                    begin
                      tvarka := false;
                      laivas (laukas, i + 1, ii + 1);
                    end;
              end;
          if (laukas[i, ii] = 0) and (laukas[i + 1, ii + 1] = 0) and
             (laukas[i + 1, ii] > 0) and (laukas[i, ii + 1] > 0)
            then
              begin
                if (laukas[i + 1, ii] = 1)
                  then
                    begin
                      tvarka := false;
                      laivas (laukas, i + 1, ii);
                    end;
                if (laukas[i, ii + 1] = 1)
                  then
                    begin
                      tvarka := false;
                      laivas (laukas, i, ii + 1);
                    end;
              end;
        end;
    kampai := tvarka;
  end;

  function suskaiciuok (var laukas : juru_laukas;
                        var laivai : juru_laivai) : boolean;
    var tvarka : boolean;
        i, ii : integer;
        dydis : integer;
  begin
    tvarka := true;
    for i := 1 to 10 do
      for ii := 1 to 10 do
        if (laukas[i, ii] = 1)
          then
            begin
              dydis := laivas (laukas, i, ii);
              if (dydis >= 1) and (dydis <= 4)
                then laivai[dydis] := laivai[dydis] + 1
                else tvarka := false;
            end;
    suskaiciuok := tvarka;
  end;

begin
  assign (f, 'musis.dat');
  reset (f);
  for i := 1 to 10 do
    begin
      for ii := 1 to 10 do
        begin
          read (f, c);
          if (c = '*')
            then laukas[i, ii] := 1
            else laukas[i, ii] := 0;
        end;
      readln (f);
    end;
  close (f);

  for i := 1 to 4 do
    laivai[i] := 0;
  kampu_tvarka := kampai (laukas);
  laivu_tvarka := suskaiciuok (laukas, laivai);
  tvarka := kampu_tvarka and laivu_tvarka;

  if (tvarka)
    then
      for i := 1 to 4 do
        if (laivai[i] <> 5 - i)
          then
            begin
              tvarka := false;
              break;
            end;

  assign (f, 'musis.rez');
  rewrite (f);
  if (tvarka)
    then writeln (f, 'GERAI')
    else
      begin
        writeln (f, 'KLAIDA');
        for i := 1 to 4 do
          begin
            if (laivai[i] = 5 - i)
              then write (f, '1')
              else write (f, '0');
            if (i <> 4)
              then write (f, ' ');
          end;
      end;
  close (f);
end.
