let get_figure a =
  let rec loop = function
      (x,y) when x = 7 && y = 7 -> "not found1"
    | (x, y) ->
       if a.(x).(y) = 1 then
         if a.(x).( (y + 1) mod 8) = 1 then
           if a.(x).( (y+2) mod 8 ) = 1 then
             "C"
           else if a.((x+1) mod 8).(y) = 1 then
             if a.( (x+1) mod 8 ).( (y+1) mod 8 ) = 1 then
               "A"
             else if a.( (x+1) mod 8 ).( (y+7) mod 8 ) = 1 then
               "G"
             else
               "not found2"
           else if a.( (x+1) mod 8 ).( (y+1) mod 8 ) = 1 then
             "E"
           else
             "not found3"
         else
           if a.((x+2) mod 8).(y) = 1 then
             "B"
           else if a.( (x+1) mod 8 ).( (y+7) mod 8) = 1 then
             "D"
           else
             "not found4"
       else
         if y = 7 then loop (x+1,0) else loop (x, y+1)
  in loop (0,0)
;;

let to_array s =
  Array.init 8 (fun x -> String.make 1 s.[x] |> int_of_string)
;;

let () =
  let rec read () =
    try let a = Array.init 8 (fun x -> read_line () |> to_array) in
        print_endline (get_figure a);
        let _ = read_line () in
        read ()
    with End_of_file -> ()
  in read ()
;;