#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][8]={
    {70,55,50,43,40,37,35,0},
    {148,116,105,89,83,77,71,0}
  };
  string s[8]={"NA","E","D","C","B","A","AA","AAA"};
  while(cin>>a>>b){
    int i;
    rep(i,8)if(a>=h[0][i]||b>=h[1][i])break;
      cout<<s[i]<<endl;
  }
  


}