#include<iostream>
using namespace std;
int main(){
	float q,p;
	while(1){
		cin >> q >> p;
		if(35.50>=q&&71.00>=p)cout << "AAA";
		else if(37.50>=q&&77.00>=p)cout << "AA";
		else if(40.00>=q&&83.00>=p)cout << 'A';
		else if(43.00>=q&&89.00>=p)cout << 'B';
		else if(50.00>=q&&105.00>=p)cout << 'C';
		else if(55.00>=q&&116.00>=p)cout <<'D';
		else if(70.00>=q&&148.00>=p)cout <<'E';
		else {
			cout << "NA";
			break;
		}
	}
	return 0;
}