// #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(), c_end=c.end(); it!=c_end; ++it)

// ------------------- include, typedef, define END. -------------------

void solve(double time500, double time1000){
	pair<double, double> timeList[7] = {
		MP(35.50,71.00),MP(37.50,77.00),MP(40.00,83.00),MP(43.00,89.00),
		MP(50.00,105.00),MP(55.00,116.00),MP(70.00,148.00)};
	string rank[7] = { "AAA", "AA", "A", "B", "C", "D", "E" };
	for (int i = 0; i < 7; i++){
		if (time500 < timeList[i].first && time1000 < timeList[i].second){
			cout << rank[i] << endl;
			return;
		}
	}
	cout << "NA" << endl;
	return;
}

int main(){
	double time500 = 0.0, time1000 = 0.0;
	while (cin >> time500 >> time1000){
		solve(time500, time1000);
	}
	return 0;
}