def ss(i, t)
  return case i
  when 0...t[0]
    0
  when t[0]...t[1]
    1
  when t[1]...t[2]
    2
  when t[2]...t[3]
    3
  when t[3]...t[4]
    4
  when t[4]...t[5]
    5
  when t[5]...t[6]
    6
  else
    7
  end
end

r = ["AAA", "AA", "A", "B", "C", "D", "E", "NA"]
t1 = [35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0]
t2 = [71, 77, 83, 89, 105, 116, 148]

while gets
  a, b = $_.split.map(&:to_f)
  puts r[[ss(a, t1), ss(b, t2)].max]
end