#include <iostream>
#include <cfloat>
using namespace std;

double shortRegTime[] = {
	35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0, DBL_MAX,
};
double longRegTime[] = {
	71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, DBL_MAX,
};

char* rank[] = {
	"AAA", "AA", "A", "B", "C", "D", "E", "NA",
};

int main()
{
	double time1, time2;
	while( cin >> time1 >> time2 ){
		for( int i = 0; i < 8; ++i ){
			if( time1 < shortRegTime[ i ] && time2 < longRegTime[ i ] ){
				cout << rank[ i ] << endl;
				break;
			}
		}
	}
	return 0;
}