#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(i=a;i>b;i--) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  double a,b;
  double h[2][7]={
    {70,55,50,43,40,37,35},
    {148,116,105,89,83,77,71}
  };
  string s[7]={"E","D","C","B","A","AA","AAA"};
  while(cin>>a>>b){
    int i;
    loop(i,6,-1)if(a<h[0][i]&&b<h[1][i])break;
    if(i+1)cout<<s[i]<<endl;
    else cout<<"NA"<<endl;
  }
}