#include<iostream>
using namespace std;

string str[8]={"AAA","AA","A","B","C","D","E","NA"};
double t[8]={35.5 , 37.5 , 40.0 , 43.0, 50.0, 55.0, 70.0,9999999.9999999};
double u[8]={71.0 , 77.0 , 83.0 , 89.0,105.0,116.0,148.0,9999999.9999999};

double a,b;

int main(){
  while(cin>>a>>b){
    for(int i=0;i<8;i++){
      if(a<t[i]&&b<u[i]){cout<<str[i]<<endl;break;}
    }
  }
  return 0;
}