#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*100),q=(int)(b*100);
        int gp,gq;
        if(p<3550)gp=0;
        else if(p<3750)gp=1;
        else if(p<4000)gp=2;
        else if(p<4300)gp=3;
        else if(p<5000)gp=4;
        else if(p<5500)gp=5;
        else if(p<7000)gp=6;
        else gp=7;

        if(q<7100)gq=0;
        else if(q<7700)gq=1;
        else if(q<8300)gq=2;
        else if(q<8900)gq=3;
        else if(q<10500)gq=4;
        else if(q<11600)gq=5;
        else if(q<14800)gq=6;
        else gq=7;
        int g=max(gp,gq);
        cout<<G[g];
    }

}