#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

int calc500(double record){
	if(record < 35.50){
		return 7;
	}else if(record < 37.50){
		return 6;
	}else if(record < 40.0){
		return 5;
	}else if(record < 43.0){
		return 4;
	}else if(record < 50.0){
		return 3;
	}else if(record < 55.0){
		return 2;
	}else if(record < 70.0){
		return 1;
	}else{
		return 0;
	}
}

int calc1000(double record){
	if(record < 71.0){
		return 7;
	}else if(record < 77.0){
		return 6;
	}else if(record < 83.0){
		return 5;
	}else if(record < 89.0){
		return 4;
	}else if(record < 105.0){
		return 3;
	}else if(record < 116.0){
		return 2;
	}else if(record < 148.0){
		return 1;
	}else{
		return 0;
	}
}

int main(){

	double t_500,t_1000;
	int rank500,rank1000,rank;

	while(scanf("%lf %lf",&t_500,&t_1000)!=EOF){
		rank500 = calc500(t_500);
		rank1000 = calc1000(t_1000);
		rank = min(rank500,rank1000);

		switch(rank){
		case 7:
			printf("AAA\n");
			break;
		case 6:
			printf("AA\n");
			break;
		case 5:
			printf("A\n");
			break;
		case 4:
			printf("B\n");
			break;
		case 3:
			printf("C\n");
			break;
		case 2:
			printf("D\n");
			break;
		case 1:
			printf("E\n");
			break;
		case 0:
			printf("NA\n");
			break;
		}
	}

    return 0;
}

