#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

int main() {
	string str[8] = {"AAA","AA","A","B","C","D","E","NA"};
	double st[2][8] = {
		{35.50, 37.50, 40.0, 43.0, 50.0, 55.0, 70.0, INF},
		{71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, INF}
	};
	
	double t[2];
	while (cin >> t[0] >> t[1]) {
		int ans[2];
		REP(i, 2) REP(j, 8) {
			if (st[i][j] > t[i]) {
				ans[i] = j;
				break;
			}
		}
		cout << str[max(ans[0], ans[1])] << endl;
		
	}
	
	return 0;
}