#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double EPS = 1e-10;

// a < b;
bool LE(const double a, const double b) {
	return (a < b + EPS);
}

int main() {
	string name[8] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
	double m500[8] = {35.50, 37.50, 40.00, 43.00, 50.00, 55.00, 1 * 60 + 10, 100000000};
	double m1000[8] = {1 * 60 + 11, 1 * 60 + 17, 1 * 60 + 23, 1 * 60 + 29, 1 * 60 + 45, 1 * 60 + 56, 2 * 60 + 28, 100000000};
#if 0
	for(int i = 0; i < 7; i++) {
		cout << name[i] + ":" << m500[i] << ":" << m1000[i] << endl;
	}
#endif
	
	for(double a, b; cin >> a >> b;) {
		int i = 0;
		while(LE(m500[i], a) || LE(m1000[i], b)) i++;
		cout << name[i] << endl;
	}
}