import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;
import std.datetime;


int call1000(double time) {
	int res = 7;
	if (time < 71.00) {
		res = 0;
	} else if (time < 77.00) {
		res = 1;
	} else if (time < 83.00) {
		res = 2;
	} else if (time < 89.00) {
		res = 3;
	} else if (time < 105.00) {
		res = 4;
	} else if (time < 116.00) {
		res = 5;
	} else if (time < 148.00) {
		res = 6;
	}

	return res; 
} 


void main()
{
	auto rank = ["AAA", "AA", "A", "B", "C", "D", "E", "NA"];
	foreach (line; stdin.byLine) {
		auto x = line.chomp.split.map!(to!double);
		int res = 7;
		
		if (x[0] < 35.50) {
			res = max(0, call1000(x[1]));
		} else if (x[0] < 37.50) {
			res = max(1, call1000(x[1]));
		} else if (x[0] < 40.00) {
			res = max(2, call1000(x[1]));
		} else if (x[0] < 43.00) {
			res = max(3, call1000(x[1]));
		} else if (x[0] < 50.00) {
			res = max(4, call1000(x[1]));
		} else if (x[0] < 55.00) {
			res = max(5, call1000(x[1]));
		} else if (x[0] < 70.00) {
			res = max(6, call1000(x[1]));
		} 
		
		writeln(rank[res]);
	}
}