#include<iostream>
using namespace std;
int main(){
  double time500,time1000;
  while( cin >> time500 >> time1000){
  if(time500<35.5&&time1000<71.0) cout << "AAA" << endl;
  else if(time500<37.5&&time1000<77.0) cout << "AA" << endl;
  else if(time500<40.0&&time1000<83.0) cout << 'A' << endl;
  else if(time500<43.0&&time1000<89.0) cout << 'B' << endl;
  else if(time500<50.0&&time1000<105.0) cout << 'C' << endl;
  else if(time500<55.0&&time1000<116.0) cout << 'D' << endl;
  else if(time500<70.0&&time1000<28.0) cout << 'E' << endl;
  else cout << "NA" << endl;
  }
  return 0;
}