#include <iostream>

using namespace std;

void solve()
{
	double time[2];
	string str[8] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
	int a = 0;
	int b = 0;
	while(cin >> time[0] >> time[1])
	{
		if(time[0] < 35.50)
		{
			a = 0;
		}
		else if(time[0] < 37.50)
		{
			a = 1;
		}
		else if(time[0] < 40.00)
		{
			a = 2;
		}
		else if(time[0] < 43.00)
		{
			a = 3;
		}
		else if(time[0] < 50.00)
		{
			a = 4;
		}
		else if(time[0] < 55.00)
		{
			a = 5;
		}
		else if(time[0] < 70.00)
		{
			a = 6;
		}
		else
		{
			a = 7;
		}

		if(time[1] < 71.00)
		{
			b = 0;
		}
		else if(time[1] < 77.00)
		{
			b = 1;
		}
		else if(time[1] < 83.00)
		{
			b = 2;
		}
		else if(time[1] < 89.00)
		{
			b = 3;
		}
		else if(time[1] < 105.00)
		{
			b = 4;
		}
		else if(time[1] < 116.00)
		{
			b = 5;
		}
		else if(time[1] < 148.00)
		{
			b = 6;
		}
		else
		{
			b = 7;
		}

		if(a >= b)
		{
			cout << str[a].data() << endl;
		}
		else
		{
			cout << str[b].data() << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}