#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>
#include <algorithm>
#include <bitset>
#include <set>
#include <functional>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;
typedef long long int lint;

string grade[8] = { "NA", "E", "D", "C", "B", "A", "AA", "AAA" };
double t500[8] = { 70, 55, 50, 43, 40, 37.5, 35.5, 0 };
double t1000[8] = { 148, 116, 105, 89, 83, 77, 71, 0 };

bool AOJ0123()
{
	double t1, t2;
	if (!(cin >> t1 >> t2)) return false;
	
	REP(i, 8) {
		if (t1 >= t500[i] || t2 >= t1000[i]) {
			cout << grade[i] << endl;
			return true;
		}
	}

	return true;
}

int main()
{

	while (AOJ0123()) {

	}

	return 0;
}