#include <iostream>
#include <string>

using namespace std;

int main(){
	double m[] = {70.0,55.0,50.0,43.0,40.0,37.5,35.5};
	double mm[] = {148.0,116.0,105.0,89.0,83.0,77.0,71.0};
	string award[] = {"NA","E","D","C","B","A","AA","AAA"};
	double t,tt;
	
	while(cin >> t >> tt){
	int g1,g2,min;
	if(m[0] <= t) g1 = -1;
	else {
		for(int i=0;i < 6;i++){
			if(m[i] > t && m[i+1] <= t) g1 = i;
		}
		if(t < m[6]) g1 =6;
	}
	if(mm[0] <= tt) g2 = -1;
	else {
		for(int i=0;i < 6;i++){
			if(mm[i] > tt && mm[i+1] <= tt) g2 = i;
		}
		if(tt < mm[6]) g2 =6;
	}
	if(g1 > g2) min = g2;
	else min = g1;
	cout << award[min+1] << endl;
	}
	
	return 0;
}