Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	m500 := []float64{35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0, 1000.0}
	m1000 := []float64{71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, 1000.0}
	classes := []string{"AAA", "AA", "A", "B", "C", "D", "E", "NA"}
	for scanner.Scan() {
		input := strings.Split(scanner.Text(), " ")
		t500, _ := strconv.ParseFloat(input[0], 64)
		t1000, _ := strconv.ParseFloat(input[1], 64)
		for i := 0; i < len(m500); i++ {
			if t500 < m500[i] && t1000 < m1000[i] {
				fmt.Println(classes[i])
				break
			}
		}
	}
}

C++: #include<stdio.h>
int main(void)
{
	float t,t1;
	while(!(scanf("%f %f",&t,&t1))){
		if(t<35.50 && t1<71.00){
			printf("AAA\n");
		}
		else if(t<37.50 && t1<77.00){
			printf("AA\n");
		}
		else if(t<40.00 && t1<83.00){
			printf("A\n");
		}
		else if(t<43.00 && t1<89.00){
			printf("B\n");
		}
		else if(t<50.00 && t1<95.00){
			printf("C\n");
		}
		else if(t<55.00 && t1<116.00){
			printf("D\n");
		}
		else if(t<70.00 && t1<148.00){
			printf("E\n");
		}
		else{
			printf("NA\n");
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cctype>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;
	while (isspace(c)) {c = gcu();}
	if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

#define m(a, b, c) make_tuple(a, b, c)

int main() {
	vector<tuple<string, double, double>> r =
	{m("AAA", 35.5, 71), m("AA", 37.5, 77), m("A", 40, 83), m("B", 43, 89),
	m("C", 50, 105), m("D", 55, 116), m("E", 70, 148), m("NA", 361, 361)};
	for (double a, b; scanf("%lf %lf", &a, &b) != EOF;)
		for (auto t: r)
			if (a < get<1>(t) && b < get<2>(t)) {
				outl(get<0>(t));
				break;
			}
}

C++: #include<iostream>

using namespace std;

int main(){
  double R5,R10;

  while(cin >> R5 >> R10){
    if(R5 < 35.50 && R10 < 71.00){
      cout << "AAA" << endl;
    }
    else if(R5 < 37.50 && R10 < 77.00){
      cout << "AA" << endl;
    }
    else if(R5 < 40.00 && R10 < 83.00){
      cout << "A" << endl;
    }
    else if(R5 < 43.00 && R10 < 89.00){
      cout << "B" << endl;
    }
    else if(R5 < 50.00 && R10 < 105.00){
      cout << "C" << endl;
    }
    else if(R5 < 55.00 && R10 < 116.00){
      cout << "D" << endl; 
    }
    else if(R5 < 70.00 && R10 < 148.00){
      cout << "E" << endl;
    }
    else{
      cout << "NA" << endl;
    }

  }
  return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	double s,l;
	while(cin>>s>>l){
		if(s<35.50 && l<60*1+11)cout<<"AAA";
		else if(s<37.50 && l<60*1+17)cout<<"AA";
		else if(s<40.00 && l<60*1+23)cout<<"A";
		else if(s<43.00 && l<60*1+29)cout<<"B";
		else if(s<50.00 && l<60*1+45)cout<<"C";
		else if(s<55.00 && l<60*1+56)cout<<"D";
		else if(s<70.00 && l<50*2+28)cout<<"E";
		else cout<<"NA";
		cout<<endl;
	}

}

C++: #include<iostream>

using namespace std;

int main(void) {
	double t5, t10;
	int t5r, t10r;

	while(true) {
		cin >> t5 >> t10;
		if(cin.eof()) { break; }

		if(t5 < 35.5) { t5r = 1; }
		else if(t5 < 37.5) { t5r = 2; }
		else if(t5 < 40.0) { t5r = 3; }
		else if(t5 < 43.0) { t5r = 4; }
		else if(t5 < 50.0) { t5r = 5; }
		else if(t5 < 55.0) { t5r = 6; }
		else if(t5 < 70.0) { t5r = 7; }
		else { t5r = 8; }

		if(t10 < 71.0) { t10r = 1; }
		else if(t10 < 77.0) { t10r = 2; }
		else if(t10 < 83.0) { t10r = 3; }
		else if(t10 < 89.0) { t10r = 4; }
		else if(t10 < 105.0) { t10r = 5; }
		else if(t10 < 116.0) { t10r = 6; }
		else if(t10 < 148.0) { t10r = 7; }
		else { t10r = 8; }

		switch(max(t5r, t10r)) {
			case 1:
				cout << "AAA" << endl;
				break;
			case 2:
				cout << "AA" << endl;
				break;
			case 3:
				cout << "A" << endl;
				break;
			case 4:
				cout << "B" << endl;
				break;
			case 5:
				cout << "C" << endl;
				break;
			case 6:
				cout << "D" << endl;
				break;
			case 7:
				cout << "E" << endl;
				break;
			default:
				cout << "NA" << endl;
				break;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

double EPS=1e-10;

int main()
{
	for(string s;getline(cin,s);){
		istringstream iss(s);
		double t1,t2;
		iss>>t1>>t2;
		int ms1=t1*1000+EPS,ms2=t2*1000+EPS;
		int a[]={35500,37500,40000,43000,50000,55000,70000};
		int b[]={71000,77000,83000,89000,105000,116000,148000};
		int i1=upper_bound(a,a+7,ms1)-a;
		int i2=upper_bound(b,b+7,ms2)-b;
		const char* res[]={"AAA","AA","A","B","C","D","E","NA"};
		cout<<res[max(i1,i2)]<<endl;
	}
	
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float a,b;
	scanf("%f %f",&a,&b);
	if(a<35.5 && b<71.0){
			printf("AAA\n");
			}
	else if(a<37.5 && b<77.0){
			printf("AA\n");
			}
	else if(a<40.0 && b<83.0){
			printf("A\n");
			}
	else if(a<43.0 && b<89.0){
			printf("B\n");
			}
	else if(a<50.0 && b<105.0){
			printf("c\n");
			}
	else if(a<55.0 && b<116.0){
			printf("D\n");
			}
	else if(a<70.0 && b<148.0){
			printf("E\n");
			}
		else{
			printf("NA\n");
			}
	return 0;
	}

C++: #include <iostream>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<21)
int main(){
	double a,b;
	while(cin >> a >> b){
		if(a<35.5  && b<71.0)puts("AAA");
		else if(a<37.5  && b<77.0)puts("AA");
		else if(a<40.0  && b<83.0)puts("A");
		else if(a<43.0  && b<89.0)puts("B");
		else if(a<50.0  && b<105.0)puts("C");
		else if(a<55.0  && b<116.0)puts("D");
		else if(a<70.0  && b<148.0)puts("E");
		else puts("NA");
	}
}