while first_input = gets
  inputs = [first_input.chomp]

  while (input = gets) && (input != "\n")
    inputs << input.chomp
  end

  inputs = inputs.join('')
  p inputs.length

  case inputs
  when /110{6}11/
    puts 'A'
  when /(10{7}){4}/
    puts 'B'
  when /1{4}/
    puts 'C'
  when /10{6}110{6}1/
    puts 'D'
  when /110{7}11/
    puts 'E'
  when /10{7}110{7}1/
    puts 'F'
  when /110{5}11/
    puts 'G'
  end
end