#include <iostream>
using namespace std;

int grade500m(double t1) {
  if(t1 < 35.50)
    return 0;
  if(t1 < 37.50)
    return 1;
  if(t1 < 40.00)
    return 2;
  if(t1 < 43.00)
    return 3;
  if(t1 < 50.00)
    return 4;
  if(t1 < 55.00)
    return 5;
  if(t1 < 70.00)
    return 6;

  return 7;
}

int grade1000m(double t2) {
  if(t2 < 71.00)
    return 0;
  if(t2 < 77.00)
    return 1;
  if(t2 < 83.00)
    return 2;
  if(t2 < 89.00)
    return 3;
  if(t2 < 105.00)
    return 4;
  if(t2 < 116.00)
    return 5;
  if(t2 < 148.00)
    return 6;

  return 7;
}

int main() {
  double t1,t2;
  while(cin >> t1 >> t2) {
    int rank1 = grade500m(t1);
    int rank2 = grade1000m(t2);
    int rank = max(rank1,rank2);
    if(rank == 0)
      cout << "AAA" << endl;
    if(rank == 1)
      cout << "AA" << endl;
    if(rank == 2)
      cout << "A" << endl;
    if(rank == 3)
      cout << "B" << endl;
    if(rank == 4)
      cout << "C" << endl;
    if(rank == 5)
      cout << "D" << endl;
    if(rank == 6)
      cout << "E" << endl;
    if(rank == 7)
      cout << "NA" << endl;
  }
}