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

int main()
{
	double t1, t2;
	string s;

	while (cin >> t1 >> t2)
	{
		if (t1 < 35.50 && t2 < 60 + 11) s = "AAA";
		else if (t1 < 37.50 && t2 < 60 + 17) s = "AA";
		else if (t1 < 40.0 && t2 < 60 + 23) s = "A";
		else if (t1 < 43.0 && t2 < 60 + 29) s = "B";
		else if (t1 < 50.0 && t2 < 60 + 45) s = "C";
		else if (t1 < 55.0 && t2 < 60 + 56) s = "D";
		else if (t1 < 60 + 10 && t2 < 60 * 2 + 28) s = "E";
		else s = "NA";

		cout << s << endl;
	}
}