#include<iostream>
using namespace std;


int main(){
	double tl500[]= {70,  55, 50, 43, 40, 37.5,  35.5};
	double tl1000[]={148,116,105, 89, 83, 77, 71};
	char *rank[]=    {"E","D","C","B","A","AA","AAA"};
	
	double a,b;
	while(cin>>a>>b){
		char *ans="NA";
		for(int i=0;i<7;i++){
			if(a<tl500[i]&&b<tl1000[i])ans=rank[i];
		}
		cout<<ans<<endl;
	}
	return 0;
}