#include<iostream>
using namespace std;
int main() {
	double a, b;
	while (cin >> a >> b){
		if (a < 35.5 && b < 61)cout << "AAA";
		else if (a < 37.5 && b < 67)cout << "AA";
		else if (a < 40 && b < 73)cout << "A";
		else if (a < 43 && b < 79)cout << "B";
		else if (a < 50 && b < 105)cout << "C";
		else if (a < 55 && b < 116)cout << "D";
		else if (a < 70 && b < 148)cout << "E";
		else cout << "NA";
		cout << endl;
	}
}