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++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

int f(double x) {
  return (x < 70.0) + (x < 55.0) + (x < 50.0) + (x < 43.0) +
         (x < 40.0) + (x < 37.0) + (x < 35.0);
}

int g(double x) {
  return (x < 148.0) + (x < 116.0) + (x < 105.0) + (x < 89.0) +
         (x < 83.0) + (x < 77.0) + (x < 71.0);
}

void solve() {
  double t1, t2;
  string t[] = {"NA", "E", "D", "C", "B", "A", "AA", "AAA"};
  while (cin >> t1 >> t2) {
    cout << t[min(f(t1), g(t2))] << endl;
  }
}

C++: #include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int main()
{
    double t1,t2;
    while( scanf( "%lf %lf\n", &t1, &t2 ) != EOF )
    {
        printf( "%lf %lf\n", t1, t2  );
        const double bound_1[7] = {35.5,37.5,40,43,50,55,70};
        const double bound_2[7] = {71,77,83,89,105,116,148};
        const string c[7] = {"AAA","AA","A","B","C","D","E"};
        int i = 0, num;
        while( 1 )
        {
            if( t1 < bound_1[i] && t2 < bound_2[i] ){
                cout << c[i] << endl;
                break;
            }
            if( i > 7 )
            {
                printf( "NA\n");
                break;
            }
            i++;
        }
        /* for( int i = 0; i < 7; i++ )
        {
            if( t1 > bound_1[i] )
            {
                num1 = i;
            }
            if( t2 > bound_2[i] )
            {
                num2 = i;
            }
        } */
       
    }
    return 0;
}

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

int main(){
	float a,b;
	cin>>a>>b;

	if( a<35.5 && b<71 )puts("AAA");
	else if( a<37.5 && b<77 )puts("AA");
	else if( a<40 && b<83 )puts("A");
	else if( a<43 && b<89 )puts("B");
	else if( a<50 && b<105 )puts("C");
	else if( a<55 && b<116)puts("D");
	else if( a<70 && b<148)puts("E");
	else puts("NA");

	return 0;
}