import scala.io.StdIn.readLine

object Main extends App {
  def evaluate(x:Double,y:Double) = {
                if(x<35.5 && y < 71.0) "AAA"
    else if(x<37.5 && y<77.0) "AA"
    else if(x<40.0 && y<83.0) "A"
    else if(x<43.0 && y<89.0) "B"
    else if(x<50.0 && y<105.0) "C"
    else if(x<55.0 && y<116.0) "D"
    else if(x<70.0 && y<148.0) "E"
    else "NA"
  }

  Iterator.continually(readLine).takeWhile(_!=null).map( _.split(" ").map(_.toDouble) ).foreach { n =>
        println(evaluate(n(0),n(1)))
  }
}