#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[51];
signed main() {
    double n, a; int b = 0, c = 0;;
    while (cin >> n >> a) {
        if (n < 35.5) { b = 7; }
        else if (n < 37.5) { b = 6; }
        else if (n < 40) { b = 5; }
        else if (n < 43) { b = 4; }
        else if (n < 50) { b = 3; }
        else if (n < 55) { b = 2; }
        else if (n < 70) { b = 1; }
        else { cout << "NA" << endl; continue; }
        if (a < 71) { c = 7; }
        else if (a < 77) { c = 6; }
        else if (a < 83) { c = 5; }
        else if (a < 89) { c = 4; }
        else if (a < 105) { c = 3; }
        else if (a < 116) { c = 2; }
        else if (a < 148) { c = 1; }
        else { cout << "NA" << endl; continue; }
        if (min(b, c) == 7) { cout << "AAA" << endl; }
        if (min(b, c) == 6) { cout << "AA" << endl; }
        if (min(b, c) == 5) { cout << "A" << endl; }
        if (min(b, c) == 4) { cout << "B" << endl; }
        if (min(b, c) == 3) { cout << "C" << endl; }
        if (min(b, c) == 2) { cout << "D" << endl; }
        if (min(b, c) == 1) { cout << "E" << endl; }
    }
}
