#include <iostream>
using namespace std;

#define MIN(X,Y) ((X)<(Y)?(X):(Y)) 
#define NUMRNK 7

int main(void){  
  double t500, t1k;
  double lim500[] = {70, 55, 50, 43, 40, 37.5, 35.5};
  double lim1k[] = {148, 116, 105, 89, 83, 77, 71};
  string rnkName[] = {"E", "D", "C", "B", "A", "AA", "AAA"};
  int rnk, rnk500, rnk1k;
  
  while (cin >> t500 >> t1k){
    rnk = rnk500 = rnk1k = -1;
    for (int i=0; i<NUMRNK; i++){
      if (t500<lim500[i]) rnk500 = i;
      if (t1k<lim1k[i]) rnk1k = i;
    }
    rnk = MIN(rnk500, rnk1k);
    if (rnk < 0) cout << "NA" << endl;
    else cout << rnkName[rnk] << endl;
  }
  return 0;
}
