class Numeric
  def point?
    self == 1
  end
end

class Array
  def sum
    self.reduce :+
  end
end

def judgment matrix
  matrix.each_with_index do |row, i|
    case row.sum
    when 1
      if matrix[i+1].sum.point? && matrix[i+2].sum.point?
        p "B"; break;
      else
        col_index = row.find_index 1
        if matrix[i+2][col_index].point?
          p "F"; break;
        else
          p "G"; break;
        end
      end
    when 2
      col_index = row.find_index 1
      next_row = matrix[i+1]
      if next_row[col_index].point? && next_row[col_index+1].point?
        p "A"; break;
      elsif next_row[col_index+1].point? && next_row[col_index+2].point?
        p "E"; break;
      else
        p "G"; break;
      end
    when 4
      p "C"; break;
    end
  end
end

row_index = 0
matrix = []
while str = STDIN.gets
  next if str == ""

  matrix << str.split('').map(&:to_i)
  row_index += 1
  if row_index == 8
    judgment matrix
    row_index = 1
    matrix = []
  end
end