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

int main() {
    double t1, t2;
    while (cin >> t1 >> t2) {
        string output;
        if (t1 < 35.5 && t2 < 71) {
            output = "AAA";
        } else if (t1 < 37.5 && t2 < 77) {
            output = "AA";
        } else if (t1 < 40 && t2 < 83) {
            output = "A";
        } else if (t1 < 43 && t2 < 89) {
            output = "B";
        } else if (t1 < 50 && t2 < 105) {
            output = "C";
        } else if (t1 < 55 && t2 < 116) {
            output = "D";
        } else if (t1 < 70 && t2 < 148) {
            output = "E";
        } else {
            output = "NA";
        }
        cout << output << endl;
    }
}