#include <iostream>
#include <string>
using namespace std;
int main()
{
	float a, b;
	string r;
	while (1)
	{
		cin >> a;
		if (cin.eof()) break;
		cin >> b;
		if (a < 35.5 && b < 71.0)
			r = "AAA";
		else if (a < 37.5 && b < 77.0)
			r = "AA";
		else if (a < 40.0 && b < 83.0)
			r = "A";
		else if (a < 43.0 && b < 89.0)
			r = "B";
		else if (a < 50.0 && b < 105.0)
			r = "C";
		else if (a < 55.0 && b < 116.0)
			r = "D";
		else if (a < 70.0 && b < 148.0)
			r = "E";
		else
			r = "NA";
		cout << r << endl;
	}
}