#include<iostream>
using namespace std;

int main(void){
	const char *classes[] = {"AAA","AA","A","B","C","D","E"};
	const double class500M[] = {35.5,37.5,40,43,50,55,70};
	const double class1000M[] = {71,77,83,89,105,116,148};

	while( true ){
		bool bNA = true;
		double c500, c1000;
		
		cin >> c500 >> c1000;
		
		if(cin.eof()) break;

		for(int i = 0; i < sizeof(class500M)/sizeof(*class500M); ++i){
			if( c500 < class500M[i] && c1000 < class1000M[i] ){
				cout << classes[i] << '\n';
				bNA = false;
				break;
			}
		}
		if( bNA )
			cout << "NA\n";
	}
	return 0;
}