#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int	i,j,flg;
	double m5,m10;
	double m5t[7]={35.5,37.5,40.0,43.0,50.0,55.0,70.0};
	double m10t[7]={71.0,77.0,83.0,89.0,105.0,116.0,148.0};
	char ran[8][8]={"AAA","AA","A","B","C","D","E"};
	while(scanf("%lf %lf",&m5,&m10)!=EOF){
		flg=0;
		for(i=0;i<=7;i++){
			if(m5<m5t[i] && m10<m10t[i]){
				printf("%s\n",ran[i]);
				flg=1;
				break;
			}
		}
		if(flg==0) printf("NA\n");
	}
	return 0;
}