#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    double time500[] = {35.5, 37.5, 40, 43, 50, 55, 70};
    double time1000[] = {71, 77, 83, 89, 105, 116, 148};
    string rank[] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};

    for(;;){
        double a, b;
        if(!(cin >> a >> b))
            return 0;

        int i = upper_bound(time500, time500 + 7, a) - time500;
        int j = upper_bound(time1000, time1000 + 7, b) - time1000;
        cout << rank[max(i, j)] << endl;
    }
}