#include <iostream>

using namespace std;

int main() {

	double ms, ml;

	while(cin >> ms >> ml) {
		if(ms<35.50)
			ms=0;
		else if(ms<37.50)
			ms=1;
		else if(ms<40.00)
			ms=2;
		else if(ms<43.00)
			ms=3;
		else if(ms<50.00)
			ms=4;
		else if(ms<55.00)
			ms=5;
		else if(ms<70.00)
			ms=6;
		else
			ms=7;
		if(ml<71.00)
			ml=0;
		else if(ml<77.00)
			ml=1;
		else if(ml<83.00)
			ml=2;
		else if(ml<89.00)
			ml=3;
		else if(ml<105.00)
			ml=4;
		else if(ml<116.00)
			ml=5;
		else if(ml<148.00)
			ml=6;
		else
			ml=7;

		if(ms<ml)
			ms=ml;

		switch((int)ms) {
			case 0:
				cout << "AAA" << endl;
				break;
			case 1:
				cout << "AA" << endl;
				break;
			case 2:
				cout << "A" << endl;
				break;
			case 3:
				cout << "B" << endl;
				break;
			case 4:
				cout << "C" << endl;
				break;
			case 5:
				cout << "D" << endl;
				break;
			case 6:
				cout << "E" << endl;
				break;
			case 7:
				cout << "NA" << endl;
				break;
		}

	}
	
	return 0;

}