#include <iostream>
using namespace std;
int main(){
  double t1,t2;
  string ch;
  while( cin >> t1 ){
    if(t1 < 35.5){
      ch = "AAA";
    }else if(t1 < 37.5){
      ch = "AA";
    } else if(t1 < 40){
      ch = "A";
    }else if(t1 < 43){
      ch = "B";
    }else if(t1 < 50){
      ch = "C";
    }else if(t1 < 55){
      ch = "D";
    }else if(t1 < 70){
      ch = "E";
    }else ch = "NA";

    cin >> t2;

    if(t2 < 71.0 && ch == "AAA"){
      ch = "AAA";
    }else if(t2 < 77 && ch == "AA"){
      ch = "AA";
    } else if(t2 < 83 && ch == "A"){
      ch = "A";
    }else if(t2 < 89 && ch == "B"){
      ch = "B";
    }else if(t2 < 105 && ch == "C"){
      ch = "C";
    }else if(t2 < 116 && ch == "D"){
      ch = "D";
    }else if(t2 < 148 && ch == "E"){
      ch = "E";
    }else ch = "NA";
    cout << ch << endl;
  }
  return 0;
}