#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  bool is=true;
  while(is){
    double a,b;
    cin>>a>>b;
    if(cin.eof()){
      is=false;
      break;
    }
    if(a<35.50&&b<71.00) cout<<"AAA"<<endl;
    else if(a<37.50&&b<77.00) cout<<"AA"<<endl;
    else if(a<40.00&&b<83.00) cout<<"A"<<endl;
    else if(a<43.00&&b<89.00) cout<<"B"<<endl;
    else if(a<50.00&&b<105.00) cout<<"C"<<endl;
    else if(a<55.00&&b<116.00) cout<<"D"<<endl;
    else if(a<70.00&&b<148.00) cout<<"E"<<endl;
    else cout<<"NA"<<endl;
  }
  return 0;
}
