#include <iostream>
using namespace std;

int main()
{
    double a,b;
    while(cin >> a >> b){
        int tmp1,tmp2;
        if(a < 35.5)
            tmp1 = 1;
        else if(a < 37.5)
            tmp1 = 2;
        else if(a < 40)
            tmp1 = 3;
        else if(a < 43)
            tmp1 = 4;
        else if(a < 50)
            tmp1 = 5;
        else if(a < 55)
            tmp1 = 6;
        else if(a < 70)
            tmp1 = 7;
        else
            tmp1 = 100;
        
        if(b < 71)
            tmp2 = 1;
        else if(a < 77)
            tmp2 = 2;
        else if(a < 83)
            tmp2 = 3;
        else if(a < 89)
            tmp2 = 4;
        else if(a < 105)
            tmp2 = 5;
        else if(a < 116)
            tmp2 = 6;
        else if(a < 148)
            tmp2 = 7;
        else
            tmp2 = 100;
        
        switch(max(tmp1,tmp2)){
            case 1:
             cout << "AAA" << endl;
             break;
            case 2:
             cout << "AA" <<endl;
             break;
            case 3:
             cout << "A" <<endl;
             break;
            case 4:
             cout << "B" <<endl;
             break;
            case 5:
             cout << "C" <<endl;
             break;
            case 6:
             cout << "D" <<endl;
             break;
            case 7:
             cout << "E" <<endl;
             break;
            case 100:
             cout << "NA" <<endl;
             break;
        }
    }
    return 0;
}