#include<iostream>

using namespace std ;

int main()

{
	float m5_limites[] = { 35.5 ,37.5 ,40.0 ,43.0 ,50.0 ,55.0 ,70.0 } ;
	float m1_limites[] = { 71.0 ,77.0 ,83.0 ,89.0 ,105.0 ,116.0 ,148.0 } ;
	string lank[] = { "AAA" ,"AA" ,"A" ,"B" ,"C" ,"D" ,"E" ,"NA" } ;

	float m5 ,m1 ;

	while( cin >> m5 >> m1 )
	{
		int i = 0 ;
		while( i < 7 && !( m5 < m5_limites[ i ] && m1 < m1_limites[ i ] ) )
			i++ ;
		cout << lank[ i ] << endl ;
	}

	return 0 ;
}