#include<iostream>
using namespace std;

int main(){
  double s,l;
  int sc,lc,g;

  while(cin >> s >> l){
    if(s<35.5)sc = 0;
    else if(s<37.5)sc = 1;
    else if(s<40.0)sc = 2;
    else if(s<43.0)sc = 3;
    else if(s<50.0)sc = 4;
    else if(s<55.0)sc = 5;
    else if(s<70.0)sc = 6;
    else sc = 7;

    if(l<71.0)lc = 0;
    else if(l<77.0)lc = 1;
    else if(l<83.0)lc = 2;
    else if(l<89.0)lc = 3;
    else if(l<105.0)lc = 4;
    else if(l<116.0)lc = 5;
    else if(l<268.0)lc = 6;
    else lc = 7;

    if(lc<sc)g=sc;
    else g=lc;

    if(g == 0)cout << "AAA" << endl;
    else if(g == 1)cout << "AA" << endl;
    else if(g == 2)cout << "A" << endl;
    else if(g == 3)cout << "B" << endl;
    else if(g == 4)cout << "C" << endl;
    else if(g == 5)cout << "D" << endl;
    else if(g == 6)cout << "E" << endl;
    else cout << "NA" << endl;
  }
  return 0;
}