#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
	double set[2][8] = { {0,35.5,37.5,40,43,50,55,70},
						  {0,71,77,83,89,105,116,148} };
	double time[2];
	while(cin>>time[0]>>time[1]){
		int class_m[2]={7,7};
		int classs;
		for(int i=0;i<2;i++){
			for(int j=0;j<7;j++){
				if(set[i][j]<=time[i]&time[i]<set[i][j+1]){
					class_m[i] = j;
					break;
				}
			}
			
		}
		classs = max(class_m[0],class_m[1]);
		switch(classs){
			case 0:
			cout << "AAA" << endl;
			break;
			case 1:
			cout << "AA" << endl;
			break;
			case 2:
			cout << "A" << endl;
			break;
			case 3:
			cout << "B" << endl;
			break;
			case 4:
			cout << "C" << endl;
			break;
			case 5:
			cout << "D" << endl;
			break;
			case 6:
			cout << "E" << endl;
			break;
			default:
			cout << "NA" << endl;
			break;
		}
	}
	return 0;
}