#include<iostream>

using namespace std;

int main(void) {
	double t5, t10;
	int t5r, t10r;

	while(true) {
		cin >> t5 >> t10;
		if(cin.eof()) { break; }

		if(t5 < 35.5) { t5r = 1; }
		else if(t5 < 37.5) { t5r = 2; }
		else if(t5 < 40.0) { t5r = 3; }
		else if(t5 < 43.0) { t5r = 4; }
		else if(t5 < 50.0) { t5r = 5; }
		else if(t5 < 55.0) { t5r = 6; }
		else if(t5 < 70.0) { t5r = 7; }
		else { t5r = 8; }

		if(t10 < 71.0) { t10r = 1; }
		else if(t10 < 77.0) { t10r = 2; }
		else if(t10 < 83.0) { t10r = 3; }
		else if(t10 < 89.0) { t10r = 4; }
		else if(t10 < 105.0) { t10r = 5; }
		else if(t10 < 116.0) { t10r = 6; }
		else if(t10 < 148.0) { t10r = 7; }
		else { t10r = 8; }

		switch(max(t5r, t10r)) {
			case 1:
				cout << "AAA" << endl;
				break;
			case 2:
				cout << "AA" << endl;
				break;
			case 3:
				cout << "A" << endl;
				break;
			case 4:
				cout << "B" << endl;
				break;
			case 5:
				cout << "C" << endl;
				break;
			case 6:
				cout << "D" << endl;
				break;
			case 7:
				cout << "E" << endl;
				break;
			default:
				cout << "NA" << endl;
				break;
		}
	}

	return 0;
}