#include <iostream>
#include <string>
using namespace std;

int main()
{
	double t1, t2;
	while (1)
	{
		cin >> t1 >> t2;
		if (cin.eof()) break;

		if (t1<35.5 && t2<71){
			cout << "AAA" << endl;
		}
		else if (t1<37.5 && t2<77){
			cout << "AA" << endl;
		}
		else if (t1<40 && t2<83){
			cout << "A" << endl;
		}
		else if (t1<43 && t2<89){
			cout << "B" << endl;
		}
		else if (t1<50 && t2<105){
			cout << "C" << endl;
		}
		else if (t1<55 && t2<116){
			cout << "D" << endl;
		}
		else if (t1<70 && t2<148){
			cout << "E" << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
	return 0;
}