/*****include*****/
#include <iostream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****変数置き場*****/
	double time_50,time_100;
	int level_50;
	int level_100;
	int level;
	/*****処理部*****/
	while(1){
		cin >> time_50 >> time_100;
		if(cin.eof())	break;
		if(time_50 < 35.5)
			level_50 = 7;
		else if(time_50 < 37.5)
			level_50 = 6;
		else if(time_50 < 40)
			level_50 = 5;
		else if(time_50 < 43)
			level_50 = 4;
		else if(time_50 < 50)
			level_50 = 3;
		else if(time_50 < 55)
			level_50 = 2;
		else if(time_50 < 70)
			level_50 = 1;
		else
			level_50 = 0;
		
		if(time_100 < 71)
			level_100 = 7;
		else if(time_100 < 77)
			level_100 = 6;
		else if(time_100 < 83)
			level_100 = 5;
		else if(time_100 < 89)
			level_100 = 4;
		else if(time_100 < 105)
			level_100 = 3;
		else if(time_100 < 116)
			level_100 = 2;
		else if(time_100 < 148)
			level_100 = 1;
		else
			level_100 = 0;
		
		if(level_100 > level_50)
			level = level_50;
		else
			level = level_100;
		
		switch(level){
		case 0:
			cout << "NA" << endl;
			break;
		case 1:
			cout << "E" << endl;
			break;
		case 2:
			cout << "D" << endl;
			break;
		case 3:
			cout << "C" << endl;
			break;
		case 4:
			cout << "B" << endl;
			break;
		case 5:
			cout << "A" << endl;
			break;
		case 6:
			cout << "AA" << endl;
			break;
		case 7:
			cout << "AAA" << endl;
			break;
		}
	}
	/*****処理終了後*****/
	return 0;
}