#include<iostream>

// ms
const int b1[7] = { 35500, 37500, 40000, 43000, 50000, 55000, 70000 },
		  b2[7] = { 71000, 77000, 83000, 89000, 105000, 116000, 148000 };

const char* cls [7] = { "AAA", "AA", "A", "B", "C", "D", "E" };

int main()
{
	double t1, t2;
	while( std::cin >> t1 >> t2 )
	{
		t1 *= 1000.0, t2 *= 1000.0;

		bool f = false;
		for( int i = 0; i != 7; ++i )
		{
			if( t1 < b1[i] && t2 < b2[i] )
			{
				std::cout << cls[i] << std::endl;
				f = true;
				break;
			}
		}

		if( !f )
			std::cout << "NA" << std::endl;
	}

	return 0;
}