#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    double a, b;
    while (cin >> a >> b) {
        string s;
        if (a < 35.5 && b < 60 + 11) {
            s = "AAA";
        } else if (a < 37.5 && b < 60 + 17) {
            s = "AA";
        } else if (a < 40 && b < 60 + 23) {
            s = "A";
        } else if (a < 43 && b < 60 + 29) {
            s = "B";
        } else if (a < 50 && b < 60 + 45) {
            s = "C";
        } else if (a < 55 && b < 60 + 56) {
            s = "D";
        } else if (a < 60 + 10 && b < 60 * 2 + 28) {
            s = "E";
        } else {
            s = "NA";
        }
        cout << s << endl;
    }
}
