#include<iostream>
using namespace std;

double time500[7] = { 35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0 };
double time1000[7] = { 71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0 };
string acd[7] = { "AAA", "AA", "A", "B", "C", "D", "E" };
int main() {
      int a,b;
      double time5,time1;
      while(cin>>time5>>time1) {
        for(int i=0; i<7; ++i) {
          if(time5 < time500[i] && time1 < time1000[i]) {
            cout<<acd[i]<<endl;
            goto NEXT;
          }
        }
        cout<<"NA"<<endl;
      NEXT:
        ;
      }
}