#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

int main(){
  int i,j;
  double n500,n1000;
  while(cin >> n500 >> n1000){
    if(n500 < 35.50 && n1000 < 60*1+11.0) cout << "AAA" << endl;
    else if(n500 < 37.50 && n1000 < 60*1+17.0) cout << "AA" << endl;
    else if(n500 < 40.0 && n1000 < 60*1+23.0) cout << "A" << endl;
    else if(n500 < 43.0 && n1000 < 60*1+29.0) cout << "B" << endl;
    else if(n500 < 50.0 && n1000 < 60*1+45.0) cout << "C" << endl;
    else if(n500 < 55.0 && n1000 < 60*1+56.0) cout << "D" << endl;
    else if(n500 < 70.0 && n1000 < 60*2+28.0) cout << "E" << endl;
    else  cout << "NA" << endl;

  }
  return 0;
}