
import std.stdio, std.typecons;

alias Tuple!(double, double, string) Time;

void main() {
  Time[] times = [
    Time(70.0, 148.0, "E"),
    Time(55.0, 116.0, "D"),
    Time(50.0, 105.0, "C"),
    Time(43.0, 89.0, "B"),
    Time(40.0, 83.0, "A"),
    Time(37.5, 77.0, "AA"),
    Time(35.5, 71.0, "AAA")];
  for(double a, b; readf("%f %f\n", &a, &b);) {
    size_t n = times.length - 1;
    int ans = -2;
    for(int i = 0; i < n; i++) {
      if (times[i][0] <= a || times[i][1] <= b) {ans = i - 1; break;}
    }
    writefln("%s", ans == -1 ? "NA" : ((ans == -2) ? "AAA" : times[ans][2]));
  }
}