#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	double a, b;
  string result;
  while(cin >> a >> b) {
    if(a < (double)35.50 && b < (double)71.00) result = "AAA";
    else if(a < (double)37.50 && b < (double)77.00) result = "AA";
    else if(a < (double)40.00 && b < (double)83.00) result = "A";
    else if(a < (double)43.00 && b < (double)89.00) result = "B";
    else if(a < (double)50.00 && b < (double)105.00) result = "C";
    else if(a < (double)55.00 && b < (double)116.00) result = "D";
    else if(a < (double)70.00 && b < (double)148.00) result = "E";
    else result = "NA";
    cout << result << endl;
  }
	return 0;
}
