#include <iostream>
#include <string>
using namespace std;

string judge(double a, double b) {
    if (a < 35.50 && b < 71.00) {
        return "AAA";
    } if (a < 37.50 && b < 77.00) {
        return "AA";
    } if (a < 40.00 && b < 83.00) {
        return "A";
    } if (a < 43.00 && b < 89.00) {
        return "B";
    } if (a < 50.00 && b < 105.00) {
        return "C";
    } if (a < 55.00 && b < 116.00) {
        return "D";
    } if (a < 70.00 && b < 148.00) {
        return "E";
    }
    return "NA";
}

int main() {
    double a, b;
    while (cin >> a >> b) {
        cout << judge(a, b) << endl;
    }
    return 0;
}