#include <vector>
#include <iostream>
#include <string>
static const std::vector<double> half{ 0, 35.50, 37.50, 40, 43, 50,55, 70 };
static const std::vector<double> kilo{ 0, 71, 77, 83, 89, 105, 116, 148 };
static const std::vector<std::string> grade{ "AAA", "AA", "A", "B", "C", "D", "E", "NA" };

int bin_half(const double &time, const int &left = 0, const int &right = 7) {
	if (left == right) {
		return left;
	}
	else {
		auto mid = ((left + right + 1) >> 1);
		if (half.at(mid) > time) {
			return bin_half(time, left, mid - 1);
		}
		else {
			return bin_half(time, mid, right);
		}
	}
}
int bin_kilo(const double &time, const int &left = 0, const int &right = 7) {
	if (left == right) {
		return left;
	}
	else {
		auto mid = ((left + right + 1) >> 1);
		if (kilo.at(mid) > time) {
			return bin_kilo(time, left, mid - 1);
		}
		else {
			return bin_kilo(time, mid, right);
		}
	}
}
std::string cul_grade(const double &half_t, const double &kilo_t) {
	auto h{ bin_half(half_t) }, k{ bin_kilo(kilo_t) };
	if (h < k) {
		return grade.at(k);
	}
	else {
		return grade.at(h);
	}
}
int main() {
	double h, k;
	while (std::cin >> h >> k) {
		std::cout << cul_grade(h, k) << '\n';
	}
	return 0;
}