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

double m500, m1000;

void solve(){
	if(m500 >= 70.00 || m1000 >= 148.00) cout << "NA" << endl;

	else if(m500 >= 55.00 || m1000 >= 116.00) cout << "E" << endl;

	else if(m500 >= 50.00 || m1000 >= 105.00) cout << "D" << endl;

	else if(m500 >= 43.00 || m1000 >= 89.00) cout << "C" << endl;

	else if(m500 >= 40.00 || m1000 >= 83.00) cout << "B" << endl;

	else if(m500 >= 37.50 || m1000 >= 77.00) cout << "A" << endl;

	else if(m500 >= 35.50 || m1000 >= 71.00) cout << "AA" << endl;

	else cout << "AAA" << endl;
}

int main(){
	while(cin >> m500 >> m1000){
		solve();
	}
}