#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    double a, b;
    int l, r;
    while(cin >> a >> b){
        if(a < 35.50){
            l = 1;
        }else if(a < 37.50){
            l = 2;
        }else if(a < 40.00){
            l = 3;
        }else if(a < 43.00){
            l = 4;
        }else if(a < 50.00){
            l = 5;
        }else if(a < 55.00){
            l = 6;
        }else if(a < 70.00){
            l = 7;
        }else{
            l = 8;
        }
        if(b < 71.00){
            r = 1;
        }else if(b < 77.00){
            r = 2;
        }else if(b < 83.00){
            r = 3;
        }else if(b < 89.00){
            r = 4;
        }else if(b < 105.00){
            r = 5;
        }else if(b < 116.00){
            r = 6;
        }else if(b < 148.00){
            r = 7;
        }else{
            r = 8;
        }
        int ans = max(l,r);
        if(ans == 1)
            cout << "AAA" << endl;
        if(ans == 2)
            cout << "AA" << endl;
        if(ans == 3)
            cout << "A" << endl;
        if(ans == 4)
            cout << "B" << endl;
        if(ans == 5)
            cout << "C" << endl;
        if(ans == 6)
            cout << "D" << endl;
        if(ans == 7)
            cout << "E" << endl;
        if(ans == 8)
            cout << "NA" << endl;
    }
}