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

int main() {
	string ra[8] = { "AAA","AA","A","B","C","D","E","NA" };
	int fr,tr,n;
	double fm, tm;
	while (cin >> fm >> tm) {
		if (fm < 35.5) { fr = 0; }
		else if (fm < 37.5) { fr = 1; }
		else if (fm < 40) { fr = 2; }
		else if (fm < 43) { fr = 3; }
		else if (fm < 50) { fr = 4; }
		else if (fm < 55) { fr = 5; }
		else if (fm < 70) { fr = 6; }
		else { fr = 7; }

		if (tm < 71) { tr = 0; }
		else if (tm < 77) { tr = 1; }
		else if (tm< 83) { tr = 2; }
		else if (tm < 89) { tr = 3; }
		else if (tm < 105) { tr = 4; }
		else if (tm < 116) { tr = 5; }
		else if (tm < 148) { tr = 6; }
		else { tr = 7; }

		if (fr <= tr) { n = tr; }
		else { n = fr; }

		cout << ra[n] << endl;
	}
	return 0;
}