while line = STDIN.gets
  t500, t1000 = line.chomp.split(' ').map { |item| item.to_f }
  if t500 < 35.5 and t1000 < 71.00 then
    puts 'AAA'
  elsif t500 < 37.5 and t1000 < 77.00 then
    puts 'AA'
  elsif t500 < 40.0 and t1000 < 83.00 then
    puts 'A'
  elsif t500 < 43.0 and t1000 < 89.00 then
    puts 'B'
  elsif t500 < 50.0 and t1000 < 105.00 then
    puts 'C'
  elsif t500 < 55.0 and t1000 < 116.00 then
    puts 'D'
  elsif t500 < 70.0 and t1000 < 148.00 then
    puts 'E'
  else 
    puts 'NA'
  end
end