#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define REP(i,a,n) for(ll i=n;i>a;i--)
int main(void){
    double t_1,t_2;
    ll num1,num2;
    double judge_500[7]={35.50,37.50,40.00,43.00,50.00,55.00,70.00};
    double judge_1000[7]={71.00,77.00,83.00,89.00,105.00,116.00,148.00};
    string rank[8]={"AAA","AA","A","B","C","D","E","NA"};
    rep(j,0,100){
        t_1 = -1;
        t_2 = -1;
        num1=-1;
        num2=-1;
        cin>>t_1>>t_2;
        rep(i,0,7){
            if(t_1<judge_500[i]){
                num1=i;
                break;
            }
        }
        rep(i,0,7){
            if(t_2<judge_1000[i]){
                num2=i;
                break;
            }
        }
        if(num1==-1)num1=7;
        if(num2==-1)num2=7;
        
        if(t_1 == -1 && t_2 == -1) break;
        cout<<rank[max(num1,num2)]<<endl;
        
    }
    
}
