#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int chk500[8]={
  35, 37, 40, 43, 50, 55, 70, INT_MAX
};
int chk1000[8]={
  71, 77, 83, 89, 105, 116, 248, INT_MAX
};
const char *rank[8]={
  "AAA","AA","A","B","C","D","E","NA"
};

int main(){
  double a,b;
  while(~scanf("%lf%lf",&a,&b)){
    REP(i,8){
      if(a < (double)chk500[i] && b < (double)chk1000[i]){
        puts(rank[i]);
        break;
      }
    }
  }
  return 0;
}