#include <iostream>
#include <string>
using namespace std;
int main( void )
{
	double a, b;
	while ( cin >> a >> b )
	{
		double check_a[] = {
			35.5,
			37.5,
			40.0,
			43.0,
			50.0,
			55.0,
			70.0
		};

		double check_b[] = {
			71.0,
			77.0,
			83.0,
			89.0,
			105.0,
			116.0,
			148.0
		};

		int i;
		for ( i = 0; i < 7; i++ )
		{
			if ( a < check_a[i] && b < check_b[i] )
				break;
		}

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

		cout << rank[i] << endl;

	}

	return 0;
}