loop do
  l = (1..8).map{gets.chomp}.join
  puts "A" if l.include?("1100000011")
  puts "B" if l.include?("1000000010000000100000001")
  puts "C" if l.include?("1111")
  puts "D" if l.include?("1000000110000001")
  puts "E" if l.include?("11000000011")
  puts "F" if l.include?("100000001100000001")
  puts "G" if l.include?("110000011")
  break unless gets
end