// 2011/01/17 Tazoe

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

int main()
{
	while(!cin.eof()){
		string str;
		getline(cin, str);
		if(str.empty())
			continue;

		istringstream ist(str);
		double tim500, tim1000;
		ist >> tim500 >> tim1000;

		if(tim500<35.50 && tim1000<71.00)
			cout << "AAA" << endl;
		else if(tim500<37.50 && tim1000<77.00)
			cout << "AA" << endl;
		else if(tim500<40.00 && tim1000<83.00)
			cout << "A" << endl;
		else if(tim500<43.00 && tim1000<89.00)
			cout << "B" << endl;
		else if(tim500<50.00 && tim1000<105.00)
			cout << "C" << endl;
		else if(tim500<55.00 && tim1000<116.00)
			cout << "D" << endl;
		else if(tim500<70.00 && tim1000<148.00)
			cout << "E" << endl;
		else
			cout << "NA" << endl;
	}

	return 0;
}