while line = gets
    t1, t2 = line.chomp.split.map(&:to_f)
    grade = "NA"
    if t1 < 35.5 && t2 < 71.0
        grade = "AAA"
    elsif t1 < 37.5 && t2 < 77.0
        grade = "AA"
    elsif t1 < 40.0 && t2 < 83.0
        grade = "A"
    elsif t1 < 43.0 && t2 < 89.0
        grade = "B"
    elsif t1 < 50.0 && t2 < 105.0
        grade = "C"
    elsif t1 < 55.0 && t2 < 116.0
        grade = "D"
    elsif t1 < 70.0 && t2 < 148.0
        grade = "E"
    end
    puts grade
end
