#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

double EPS=1e-10;

int main()
{
	for(string s;getline(cin,s);){
		istringstream iss(s);
		double t1,t2;
		iss>>t1>>t2;
		int ms1=t1*1000+EPS,ms2=t2*1000+EPS;
		int a[]={35500,37500,40000,43000,50000,55000,70000};
		int b[]={71000,77000,83000,89000,105000,116000,148000};
		int i1=upper_bound(a,a+7,ms1)-a;
		int i2=upper_bound(b,b+7,ms2)-b;
		const char* res[]={"AAA","AA","A","B","C","D","E","NA"};
		cout<<res[max(i1,i2)]<<endl;
	}
	
	return 0;
}