#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
	double t1, t2;
	
	int rank1,rank2;
	
	while(scanf("%lf %lf", &t1, &t2) != EOF){
		
		if (t1 < 35.50) rank1 = 1;
		else if (t1 < 37.50) rank1 = 2;
		else if (t1 < 40.0) rank1 = 3;
		else if (t1 < 43.0) rank1 = 4;
		else if (t1 < 50.0) rank1 = 5;
		else if (t1 < 55.0) rank1 = 6;
		else if (t1 < 70.0) rank1 = 7;
		else rank1 = 8;
		
		if (t2 < 71.0) rank2 = 1;
		else if(t2 < 77.0) rank2 = 2;
		else if(t2 < 83.0) rank2 = 3;
		else if(t2 < 89.0) rank2 = 4;
		else if(t2 < 105.0) rank2 = 5;
		else if(t2 < 116.0) rank2 = 6;
		else if(t2 < 148.0) rank2 = 7;
		else rank2 = 8;
		
		int rank = max(rank1, rank2);
		
		if(rank == 1) puts("AAA");
		if(rank == 2) puts("AA");
		if(rank == 3) puts("A");
		if(rank == 4) puts("B");
		if(rank == 5) puts("C");
		if(rank == 6) puts("D");
		if(rank == 7) puts("E");
		if(rank == 8) puts("NA");
		
	}
}