#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
	double s, l;
	int s_r, l_r;
	int res;
	
	
	while(cin >> s >> l){
		if(s < 35.5){
			s_r = 0;
		}else if(s < 37.5){
			s_r = 1;
		}else if(s < 40){
			s_r = 2;
		}else if(s < 43){
			s_r = 3;
		}else if(s < 50){
			s_r = 4;
		}else if(s < 55){
			s_r = 5;
		}else if(s < 70){
			s_r = 6;
		}else{
			s_r = 7;
		}
		if(l < 71){
			l_r = 0;
		}else if(s < 77){
			l_r = 1;
		}else if(s < 83){
			l_r = 2;
		}else if(s < 89){
			l_r = 3;
		}else if(s < 105){
			l_r = 4;
		}else if(s < 116){
			l_r = 5;
		}else if(s < 148){
			l_r = 6;
		}else{
			l_r = 7;
		}
		
		res = max(s_r, l_r);
		
		switch(res){
			case 0:
				cout << "AAA" << endl;
				break;
			case 1:
				cout << "AA" << endl;
				break;
			case 2:
				cout << "A" << endl;
				break;
			case 3:
				cout << "B" << endl;
				break;
			case 4:
				cout << "C" << endl;
				break;
			case 5:
				cout << "D" << endl;
				break;
			case 6:
				cout << "E" << endl;
				break;
			case 7:
				cout << "NA" << endl;
				break;
		}
	}
}