def judge(t500,t1000)
  rank = [\
          ["AAA",35.5, 71.0],\
          ["AA", 37.5, 77.0],\
          ["A",  40.0, 83.0],\
          ["B",  43.0, 89.0],\
          ["C",  50.0,105.0],\
          ["D",  55.0,116.0],\
          ["E",  70.0,148.0],\
          ["NA",999999.9,9999999.9]]
  rank.select{|r,t0,t1| t500<t0 and t1000<t1}.first.first
end
def main
  if true then
    fh=STDIN
  else
    fh=open"in1_0123.txt"
  end
  while fh.gets do
    t500,t1000=$_.chomp.split.map{|x| x.to_f}
    puts judge(t500,t1000)
  end
end

if $0 == __FILE__ then
  main
end