#include<iostream>
using namespace std;
int main() {
	double a, b;
	int ans[111], an,aa,bb;
	an = 0;
	while (cin >> a >> b) {
		an = an + 1;
		if (a <35.5 ) {
			aa = 1;
			goto h;
		}
		if (a < 37.5) {
			aa = 2;
			goto h;
		}
		if (a < 40) {
			aa = 3;
			goto h;
		}
		if (a < 43) {
			aa = 4;
			goto h;
		}
		if (a < 50) {
			aa = 5;
			goto h;
		}
		if (a < 55) {
			aa =6 ;
			goto h;
		}
		if (a <70 ) {
			aa = 7;
			goto h;
		}
		aa = 8;
	h:;
		if (b < 71) {
			bb= 1;
			goto m;
		}
		if (b < 77) {
			bb = 2;
			goto m;
		}
		if (b < 83) {
			bb = 3;
			goto m;
		}
		if (b < 89) {
			bb =4 ;
			goto m;
		}
		if (b < 105) {
			bb = 5;
			goto m;
		}
		if (b < 116) {
			bb = 6;
			goto m;
		}
		if (b < 148) {
			bb = 7;
			goto m;
		}
		bb = 8;
	m:;
		if (aa < bb) {
			ans[an] = bb;
		}
		else {
			ans[an] = aa;
		}
	}
	for (int i = 1; i <= an; i++) {
		if (ans[i] == 1) {
			cout << "AAA"<< endl;
		}
		if (ans[i] == 2) {
			cout<<"AA" <<endl;
		}
		if (ans[i] == 3) {
			cout<<"A" <<endl;
		}
		if (ans[i] == 4) {
			cout<< "B"<<endl;
		}
		if (ans[i] == 5) {
			cout<< "C"<<endl;
		}
		if (ans[i] == 6) {
			cout<<"D"<<endl;
		}
		if (ans[i] == 7) {
			cout << "E" << endl;
		}
		if (ans[i] == 8) {
			cout << "NA" << endl;
		}




	}

}
