#include<iostream>
using namespace std;

int main(void){
     double n,m;
     cin >> n >> m;
     if(n < 35 and m < 71){
	  cout << "AAA" << endl;
     }else if(n < 37 and m < 77){
	  cout << "AA" << endl;
     }else if(n < 40 and m < 83){
	  cout << "A" << endl;
     }else if(n < 43 and m < 89){
	  cout << "B" << endl;
     }else if(n < 50 and m < 105){
	  cout << "C" << endl;
     }else if(n < 55 and m < 116){
	  cout << "D" << endl;
     }else if(n < 70 and m < 148){
	  cout << "E" << endl;
     }else{
	  cout << "NA" << endl;
     }
     return 0;
}