#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
/*
jq	 500M	 1000M
AAA	 35b50	 1ª11b00
AA	 37b50	 1ª17b00
A	 40b00	 1ª23b00
B	 43b00	 1ª29b00
C	 50b00	 1ª45b00
D	 55b00	 1ª56b00
E	1ª10b00	2ª28b00
*/
int main()
{
	const double t500m[] = { 
		0.00, 35.50, 37.50, 40.00, 43.00, 50.00, 55.00, 70.00, DBL_MAX };
	const double t1000m[] = {
		0.00, 71.00, 77.00, 83.00, 89.00, 105.00, 116.00, 148.00, DBL_MAX };
	const string cname[] = { "AAA", "AA", "A", "B", "C", "D", "E", "NA" };

//	cut here before submit 
//	freopen ("testcase.speedskat", "r", stdin );

	string str = "";
	int i,j;
	while (getline (cin, str ) ){
		double time1, time2;
		stringstream ss(str);
		ss >> time1 >> time2;

		int c500 = -1;
		int c1000 = -1;
		for (i = 0; i < sizeof(t500m)/sizeof(t500m[0]) - 1; ++i){
			if (time1 >= t500m[i] && time1 < t500m[i+1] ){
				c500 = i;
				break;
			} // end if
		} // end for

		for (j = 0; j < sizeof(t1000m)/sizeof(t1000m[0]) - 1; ++j){
			if (time2 >= t1000m[j] && time2 < t1000m[j+1] ){
				c1000 = j;
				break;
			} // end if
		} // end for

		int decide_class = max (c500, c1000);
		cout << cname[decide_class] << endl;

	} // end loop
		
	return 0;
}