#include <iostream>
using namespace std;
int main(){
  double t1,t2;
  string ch;
  while( cin >> t1 >> t2){

    if(t1 < 35.5 && t2 < 71){
      ch = "AAA";
    }else if(t1 < 37.5 && t2 < 77){
      ch = "AA";
    } else if(t1 < 40 && t2 < 83){
      ch = "A";
    }else if(t1 < 43 && t2 < 89){
      ch = "B";
    }else if(t1 < 50 && t2 < 105){
      ch = "C";
    }else if(t1 < 55 && t2 < 116){
      ch = "D";
    }else if(t1 < 70 && t2 < 148){
      ch = "E";
    }else ch = "NA";
    cout << ch << endl;
  }
  return 0;
}