#!/usr/bin/ruby -Ku

require 'pp'

time1 = [35.5, 37.5, 40.0, 43.0, 50.0,  55.0,  70.0, 2<<30 ]
time2 = [71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, 2<<30]

rank = ["AAA", "AA", "A", "B", "C", "D", "E", "NA"]

loop do
  line = gets
  break if line == nil
  
  t1, t2 = line.split(nil).map(&:to_f)
  i = 0
  time1.length.times{|i|
    if t1 < time1[i] && t2 < time2[i] then
      puts rank[i]
      break
    end
  }
end