#include <bits/stdc++.h>
using namespace std;
int main(void){
    double t500,t1000;
    while (cin>>t500>>t1000) {
        if (t500<35.50&&t1000<71.00) {
            cout<<"AAA"<<endl;
        } else if (t500<37.50&&t1000<77.00) {
            cout<<"AA"<<endl;
        } else if (t500<40.00&&t1000<83.00) {
            cout<<"A"<<endl;
        } else if (t500<43.00&&t1000<89.00) {
            cout<<"B"<<endl;
        } else if (t500<50.00&&t1000<105.00) {
            cout<<"C"<<endl;
        } else if (t500<55.00&&t1000<116.00) {
            cout<<"D"<<endl;
        } else if (t500<70.00&&t1000<148.00) {
            cout<<"E"<<endl;
        } else {
            cout<<"NA"<<endl;
        }
    }
}

