#include <iostream>
using namespace std;

int main()
{

	double time5, time10;

	while( cin >> time5 >> time10 ) {

		if( time5 < 35.50 && time10 < 71.00 ) cout << "AAA";
		else if( time5 < 37.50 && time10 < 77.00 ) cout << "AA";
		else if( time5 < 40.00 && time10 < 83.00 ) cout << "A";
		else if( time5 < 43.00 && time10 < 89.00 ) cout << "B";
		else if( time5 < 50.00 && time10 < 105.00 ) cout << "C";
		else if( time5 < 55.00 && time10 < 116.00 ) cout << "D";
		else if( time5 < 70.00 && time10 < 148.00 ) cout << "E";
		else cout << "NA";

		cout << endl;

	}

	return 0;

}