#include <iostream>
using namespace std;
int main(){
	double t1,t2;
	while(cin>>t1>>t2){
		const double T1[]={70.00,55.00,50.00,43.00,40.00,37.50,35.50,0};
		const double T2[]={148.00,116.00,105.00,89.00,83.00,77.00,71.00,0};
		const string N[]={"NA","E","D","C","B","A","AA","AAA"};
		for(int i=0;i<8;++i){
			if(T1[i]<=t1||T2[i]<=t2){
				cout<<N[i]<<endl;
				break;
			}
		}
	}
	return 0;
}