while gets
  l = $_.chomp
  t = 8
  t = 7 if l != ""
  t.times do
    l << gets.chomp
  end
  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")
end