#include <bits/stdc++.h>

using namespace std;

const string Level[8] = { "AAA","AA", "A", "B", "C", "D", "E","NA" };
const double Time1[8] = { 35.50 , 37.50 , 40.00 , 43.00, 50.00, 55.00, 70.00,DBL_MAX };
const double Time2[8] = { 71.00 , 77.00 , 83.00 , 89.00,105.00,116.00,148.00,DBL_MAX };

int solve(double t1, double t2) {

	

	return 0;
}

int main() {
	double t1,t2;

	while (cin >> t1 >> t2) {
		for (int i = 0; i < 8; i++) {
			if (t1 < Time1[i] && t2 < Time2[i]) {
				cout << Level[i] << endl;
				break;
			}
		}
	}

	return 0;
}
