import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;
real[] r1 = [ 70,55,50,43,40,37,35];
real[] r2 = [ 148,116,105,89,83,77,71];
string[] ans = ["NA","E","D","C","B","A","AA","AAA"];

void main(){

    while(true){
	string ss = readln();
	if(stdin.eof()) break;
	auto s = ss.split().to!(real[]);
	for(int i=6;i>=0;i--){
	    if(s[0] < r1[i] && s[1] < r2[i]){
		writeln(ans[i+1]);
		break;
	    }
	    if(i == 0)
		writeln(ans[0]);
	}
    }

}