#include<iostream>
#include<string>
using namespace std;
double time5M, time10M;

void score(){
	string rank="NA";
	if(time5M < 70.0 && time10M < 148.0) rank="E";
	if(time5M < 55.0 && time10M < 116.0) rank="D";
	if(time5M < 50.0 && time10M < 105.0) rank="C";
	if(time5M < 43.0 && time10M < 89.0) rank="B";
	if(time5M < 40.0 && time10M < 83.0) rank="A";
	if(time5M < 37.5 && time10M < 77.0) rank="AA";
	if(time5M < 35.5 && time10M < 71.0) rank="AAA";
	cout << rank << endl;
}

int main(){
	while(cin >> time5M >> time10M){
		score();
	}
	return 0;
}