#include <iostream>

using namespace std;
/** problem0123 : Speed Skating Badge Test **/
int main()
{
	double rank500[8] = {35.5, 37.5, 40, 43, 50, 55, 70};
	double rank1000[8] = {71, 77, 83, 89, 105, 116, 148};
	string rank[8] = {"AAA", "AA", "A", "B", "C", "D", "E"};
	double a, b;
	
	while (cin >> a >> b) {
		string ra="NA";
		for (int i=0; i<8; i++) {
			if (a < rank500[i] && b < rank1000[i]) {
				ra = rank[i];
				break;
			}
		}
		cout << ra << endl;
	}
}