#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	string st;
	while (getline(cin, st)) {
		ld a = stod(st.substr(0, st.find(" ")));
		ld b = stod(st.substr(st.find(" ")));
		a += 0.001;
		b += 0.001;
		if (a < 35.5&&b < 71)cout << "AAA" << endl;
		else if (a < 37.5&&b < 77)cout << "AA" << endl;
		else if (a < 40 && b < 83)cout << "A" << endl;
		else if (a < 43 && b < 89)cout << "B" << endl;
		else if (a < 50 && b < 105)cout << "C" << endl;
		else if (a < 55 && b < 116)cout << "D" << endl;
		else if (a < 70 && b < 148)cout << "E" << endl;
		else cout << "NA" << endl;
	}
	return 0;
}