#include <iostream>

using namespace std;

int result500=0,result1000=0;

void time500m(double time){
    if(time < 35.50){
        result500=0;
    }
    else if(time >= 35.50 && time < 37.50 ){
        result500=1;
    }
    else if(time >= 37.50 && time < 40 ){
        result500=2;
    }
    else if(time >= 40 && time < 43 ){
        result500=3;
    }
    else if(time >= 43 && time < 50 ){
        result500=4;
    }
    else if(time >= 50 && time < 55 ){
        result500=5;
    }
    else if(time >= 55 && time < 70 ){
        result500=6;
    }
    else if(time >= 70 ){
        result500=7;
    }
}

void time1000m(double time){
    if(time < 71){
        result1000=0;
    }
    else if(time >= 71 && time < 77 ){
        result1000=1;
    }
    else if(time >= 77 && time < 83 ){
        result1000=2;
    }
    else if(time >= 83 && time < 89 ){
        result1000=3;
    }
    else if(time >= 89 && time < 105 ){
        result1000=4;
    }
    else if(time >= 105 && time < 116 ){
        result1000=5;
    }
    else if(time >= 116 && time < 148 ){
        result1000=6;
    }
    else if(time >= 148){
        result1000=7;
    }
}

int main() {

    int result;
    double time500,time1000;

    while(cin >> time500 >> time1000){
        
        time500m(time500);
        time1000m(time1000);

        if(result500>result1000){
            result=result500;
        }
        else{
            result=result1000;
        }

        switch(result){
        case 0 : cout << "AAA" << endl; break;
        case 1 : cout << "AA" << endl; break;
        case 2 : cout << "A" << endl; break;
        case 3 : cout << "B" << endl; break;
        case 4 : cout << "C" << endl; break;
        case 5 : cout << "D" << endl; break;
        case 6 : cout << "E" << endl; break;
        case 7 : cout << "NA" << endl; break;
        }
        
    }

    return 0;
}