#include<iostream>
#include<map>
#include<string>
using namespace std;

int main(){

	int n;
	double five, ten;
	map<int, string> mp;
	double cls[7][2] = {{70.0, 148.0},
											{55.0, 116.0},
											{50.0, 105.0},
											{43.0, 89.0},
											{40.0, 83.0},
											{37.5, 77.0},
											{35.5, 71.0}};
	mp.insert(make_pair(0, "NA"));
	mp.insert(make_pair(1, "E"));
	mp.insert(make_pair(2, "D"));
	mp.insert(make_pair(3, "C"));
	mp.insert(make_pair(4, "B"));
	mp.insert(map<int, string>::value_type(5, "A"));
	mp.insert(pair<int, string>(6, "AA"));
	mp.insert(make_pair(7, "AAA"));
	
	while(cin >> five >> ten){
		n = 0;
		for(int i=0; i<7; i++){
			if(five < cls[i][0] && ten < cls[i][1]){
				 n++;
				 if(i == 6) cout << mp[n] << endl;
			}
			else{
				cout << mp[n] << endl;
				break;
			}
		}
	}

	return 0;

}