#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <queue>
#include <vector>
#include <sstream>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;

int main(void){

double a,b;
string nam[] = {"AAA","AA","A","B","C","D","E"};
double r05[] ={35.5,37.5,40.0,43.0,50.0,55.0,70.0}; 
double r10[] ={71.0,77.0,83.0,89.0,105.0,116.0,148.0}; 
	while(cin >> a >> b){
		if(a==0 && b==0 || cin.eof()) break;
		string ans = "NA";
		rep(i,7) 
			if( a<r05[i] && b<r10[i] ){
				ans = nam[i];
				break;
			}
		cout << ans << endl;
	}
	
	
	return 0;
	
}