#include<iostream>
#include<string>
using namespace std;

int main(){

  double n,m;

  while(cin >> n >> m){

    bool d = false;
    string c = "";

    if(n < 70 && m < 148) c = "E", d = true;
    if(n < 55 && m < 60+56) c = "D", d = true;
    if(n < 50 && m < 60+45) c = "C", d = true;
    if(n < 43 && m < 60+29) c = "B", d = true;
    if(n < 40 && m < 60+23) c = "A", d = true;
    if(n < 37.50 && m < 60+17) c = "AA", d = true;
    if(n < 35.50 && m < 60+11) c = "AAA", d = true;

    if(d) cout << c << endl;
    if(!d) cout << "NA" << endl;

  }

}