#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<map>
using namespace std;
int main(){
    string G[8]={
        "AAA",
        "AA",
        "A",
        "B",
        "C",
        "D",
        "E",
        "NA",
    };
    double a,b;
    while(cin>>a>>b){
        int p=(int)(a*1000),q=(int)(b*1000);
        int gp,gq;
        if(p<35500)gp=0;
        else if(p<37500)gp=1;
        else if(p<40000)gp=2;
        else if(p<43000)gp=3;
        else if(p<50000)gp=4;
        else if(p<55000)gp=5;
        else if(p<70000)gp=6;
        else gp=7;

        if(q<71000)gq=0;
        else if(q<77000)gq=1;
        else if(q<83000)gq=2;
        else if(q<89000)gq=3;
        else if(q<105000)gq=4;
        else if(q<116000)gq=5;
        else if(q<148000)gq=6;
        else gq=7;
        int g=max(gp,gq);
        cout<<G[g]<<endl;
    }

}