#include <iostream>
#include <algorithm>
//v7KÉª¯çêé
const int RANKC = 7,NA = 7;
double R_500[RANKC] = {35.5,37.5,40,43,50,55,70},
  R_1000[RANKC] = {71,77,83,89,105,116,148};

//tÍÔBmÍ0©1(»ê¼ê500,1000m)
int rcheck(double t,int m){
  double *rlist;
  (m)?rlist=R_1000:rlist=R_500;
  for(int i=0;i<RANKC;i++){
    if(t<*(rlist+i))return i;
  }
  return NA;
}

std::string res[] = {"AAA","AA","A","B","C","D","E","NA"};
int main(){
  double t_500,t_1000;
  while(std::cin>>t_500>>t_1000){
    if(std::cin.eof())break;
    //êÔá¢NðèÉüêéB
    int rank = std::max(rcheck(t_500,0),rcheck(t_1000,1));
    std::cout<<res[rank]<<std::endl;
  }
  return 0;
}