require 'pp'

class Surface
  def initialize
    results = []

    while input = $stdin.gets 
      @map = Array.new(8).map{Array.new(8,0)}
      if input =~ /\d/
        @map[0] = input.chomp.split('')
        7.times do |n|
          @map[n+1] = $stdin.gets.chomp.split('')
        end

        results << check
      end
    end

    results.each do |ans|
      puts ans
    end
  end

  def check_bc(x,y)
    begin
      if @map[y+1][x] == "1"
        return "B"
      else
        return "C"
      end
    rescue
      return "C"
    end
  end

  def check_def(x,y)
    begin
      if @map[y][x+1] == "1"
        return "E"
      elsif @map[y+1][x-1] == "1"
        return "D"
      else
        return "F"
      end
    rescue
      return "D"
    end
  end

  def check_ag(x,y)
    begin
      if @map[y+1][x-1] == "1"
        return "G"
      else
        return "A"
      end
    rescue
      return "A"
    end
  end

  def check
    0.upto(7) do |y|
      0.upto(7) do |x|
        if @map[y][x] == "1"
          case get_around(x,y)
          when 1
            return check_bc(x,y)
          when 2
            return check_def(x,y)
          when 3
            return check_ag(x,y)
          end
        end
      end
    end
  end
  
  def range_check(x,y)
    0 <= x && x < 8 && 0 <= y && y < 8
  end

  def get_around(x,y)
    count = 0
    (y-1).upto(y+1) do |ypos|
      (x-1).upto(x+1) do |xpos|
        if range_check(xpos,ypos) && (xpos != x || ypos != y)
          count += 1 if @map[ypos][xpos] == "1"
        end
      end
    end
    return count
  end
end

s = Surface.new