#include <iostream>
using namespace std;

string solve(double a, double b){
    if(a < 35.5 && b <  71.0) return "AAA";
    if(a < 37.5 && b <  77.0) return "AA";
    if(a < 40.0 && b <  83.0) return "A";
    if(a < 43.0 && b <  89.0) return "B";
    if(a < 50.0 && b < 105.0) return "C";
    if(a < 55.0 && b < 116.0) return "D";
    if(a < 70.0 && b < 148.0) return "E";
    return "NA";
}

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