#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(){
  string ans[8]={"AAA","AA","A","B","C","D","E","NA"};
  double a,b,aa,bb;
  while(cin>>a>>b){
    if(a<35.50)aa=0;
    else if(a<37.50)aa=1;
    else if(a<40.00)aa=2;
    else if(a<43.00)aa=3;
    else if(a<50.00)aa=4;
    else if(a<55.00)aa=5;
    else if(a<70.00)aa=6;
    else aa=7;
    if(b<71.00)bb==0;
    else if(b<77.00)bb=1;
    else if(b<83.00)bb=2;
    else if(b<89.00)bb=3;
    else if(b<105.00)bb=4;
    else if(b<116.00)bb=5;
    else if(b<148.00)bb=6;
    else bb=7;
    int res=max(aa,bb);
    cout<<ans[res]<<endl;
  }
}