#include<stdio.h>
int main()
{
	double t500,t1000;
	int i,j;
	int r500,r1000;
	int re;
	while(scanf("%lf",&t500)!=EOF){
		scanf("%lf",&t1000);
		if	   (t500<35.50)r500=0;
		else if(t500<37.50)r500=1;
		else if(t500<40.00)r500=2;
		else if(t500<43.00)r500=3;
		else if(t500<50.00)r500=4;
		else if(t500<55.00)r500=5;
		else if(t500<70.00)r500=6;
		else r500=7;
		
		if	   (t1000<71.00)r1000=0;
		else if(t1000<77.00)r1000=1;
		else if(t1000<83.00)r1000=2;
		else if(t1000<89.00)r1000=3;
		else if(t1000<105.00)r1000=4;
		else if(t1000<116.00)r1000=5;
		else if(t1000<148.00)r1000=6;
		else r1000=7;
		
		if(r500<r1000)re=r1000;
		else if(r500>r1000)re=r500;
		else if(r500==r1000)re=r500;
		
		switch(re){
			case 0:
				puts("AAA");
				break;
			case 1:
				puts("AA");
				break;
			case 2:
				puts("A");
				break;
			case 3:
				puts("B");
				break;
			case 4:
				puts("C");
				break;
			case 5:
				puts("D");
				break;
			case 6:
				puts("E");
				break;
			case 7:
				puts("NA");
				break;
			default :
				break;
		}
	}
	return 0;
}