#include<iostream>
using namespace std;
int main(){
  int rf,rt;
  double f,t;
  for(;;){
    f=-1.0;
    t=-1.0;
    cin>>f>>t;
    if(f==-1&&t==-1)
      break;
    if(f<35.5)
      rf=0;
    else if(f<37.5)
      rf=1;
    else if(f<40)
      rf=2;
    else if(f<43)
      rf=3;
    else if(f<50)
      rf=4;
    else if(f<55)
      rf=5;
    else if(f<70)
      rf=6;
    else
      rf=7;
    if(t<71)
      rt=0;
    else if(t<77)
      rt=1;
    else if(t<83)
      rt=2;
    else if(t<89)
      rt=3;
    else if(t<105)
      rt=4;
    else if(t<116)
      rt=5;
    else if(t<148)
      rt=6;
    else
      rt=7;
    switch(rf>rt?rf:rt){
    case 0:
      cout<<"AAA"<<endl;
      break;
    case 1:
      cout<<"AA"<<endl;
      break;
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      cout<<(char)('A'+(rf>rt?rf:rt)-2)<<endl;
      break;
    default:
      cout<<"NA"<<endl;
      break;
    }
  }
  return 0;
}