#include<iostream>
using namespace std;

void out_grade(double M_500_time,double M_1000_time){
  if(M_500_time<35.50&&M_1000_time<71.0)cout<<"AAA"<<endl;
  else if(M_500_time<37.50&&M_1000_time<77.00)cout<<"AA"<<endl;
  else if(M_500_time<40.00&&M_1000_time<83.00)cout<<"A"<<endl;
  else if(M_500_time<43.00&&M_1000_time<89.00)cout<<"B"<<endl;
  else if(M_500_time<50.00&&M_1000_time<105.00)cout<<"C"<<endl;
  else if(M_500_time<55.00&&M_1000_time<116.00)cout<<"D"<<endl;
  else if(M_500_time<70.00&&M_1000_time<148.00)cout<<"E"<<endl;
  else cout<<"NA"<<endl;
}

int main(){
  double M_500_time,M_1000_time;
  while(cin>>M_500_time>>M_1000_time){
    out_grade(M_500_time,M_1000_time);
  }
}