#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;


int main()
{
	char* rank[] = { "AAA", "AA", "A", "B", "C", "D", "E", "NA" };
	double fif[] = { 35.5, 37.5, 40, 43, 50, 55, 70, 1e10 };
	double th[] = { 71, 77, 83, 89, 105, 116, 148, 1e10 };
	double a, b;
	while (scanf("%lf %lf", &a, &b) != EOF)
	{
		int i;
		for (i = 0; a >= fif[i] || b >= th[i]; ++i)
			;
		puts(rank[i]);
	}

	return 0;
}