Go: package main

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

func main() {
	badge := []string{"AAA", "AA", "A", "B", "C", "D", "E"}
	badgeLen := len(badge)
	short := []float64{35.5, 37.5, 40, 43, 50, 55, 70}
	long := []float64{71, 77, 83, 89, 105, 116, 148}

	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		time := strings.Split(stdin.Text(), " ")

		sT, _ := strconv.ParseFloat(time[0], 64)
		lT, _ := strconv.ParseFloat(time[1], 64)

		sR, lR, t := 0, 0, 0.0
		for _, t = range short {
			if sT < t {
				break
			}
			sR++
		}
		for _, t = range long {
			if lT < t {
				break
			}
			lR++
		}
		rank := ""
		if sR >= badgeLen || lR >= badgeLen {
			rank = "NA"
		} else if sR >= lR {
			rank = badge[sR]
		} else {
			rank = badge[lR]
		}
		fmt.Println(rank)
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
	double set[2][8] = { {0,35.5,37.5,40,43,50,55,70},
						  {0,71,77,83,89,105,116,148} };
	double time[2];
	while(cin>>time[0]>>time[1]){
		int class_m[2]={7,7};
		int classs;
		for(int i=0;i<2;i++){
			for(int j=0;j<7;j++){
				if(set[i][j]<=time[i]&time[i]<set[i][j+1]){
					class_m[i] = j;
					break;
				}
			}
			
		}
		classs = max(class_m[0],class_m[1]);
		switch(classs){
			case 0:
			cout << "AAA" << endl;
			break;
			case 1:
			cout << "AA" << endl;
			break;
			case 2:
			cout << "A" << endl;
			break;
			case 3:
			cout << "B" << endl;
			break;
			case 4:
			cout << "C" << endl;
			break;
			case 5:
			cout << "D" << endl;
			break;
			case 6:
			cout << "E" << endl;
			break;
			default:
			cout << "NA" << endl;
			break;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	double a,b;
	while(cin>>a>>b){
		string z="NA";
		if(a<70&&b<148)
			z="E";
		if(a<55&&b<116)
			z="D";
		if(a<50&&b<105)
			z="C";
		if(a<43&&b<89)
			z="B";
		if(a<40&&b<83)
			z="A";
		if(a<37.5&&b<77)
			z="AA";
		if(a<35.5&&b<71)
			z="AAA";
		cout<<z<<endl;
	}
    return 0;
}

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

int main(void){
	double x,y;

	while(cin>>x>>y){
		if(x < 35.5 && y < 71){
			cout<<"AAA\n";
		}
		else if(x < 37.5 && y < 77){
			cout<<"AA\n";
		}
		else if(x < 40 && y < 83){
			cout<<"A\n";
		}
		else if(x < 43 && y < 89){
			cout<<"B\n";
		}
		else if(x < 50 && y < 105){
			cout<<"C\n";
		}
		else if(x < 55 && y < 116){
			cout<<"D\n";
		}
		else if(x < 70 && y < 148){
			cout<<"E\n";
		}
		else{
			cout<<"NA\n";
		}
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  double t1,t2;
  string ch;
  while( cin >> t1 ){
    if(t1 < 35.5){
      ch = "AAA";
    }else if(t1 < 37.5){
      ch = "AA";
    } else if(t1 < 40){
      ch = "A";
    }else if(t1 < 43){
      ch = "B";
    }else if(t1 < 50){
      ch = "C";
    }else if(t1 < 55){
      ch = "D";
    }else if(t1 < 70){
      ch = "E";
    }else ch = "NA";

    cin >> t2;

    if(t2 < 71.0 && ch == "AAA"){
      ch = "AAA";
    }else if(t1 < 37.5){
      ch = "AA";
    } else if(t1 < 40){
      ch = "A";
    }else if(t1 < 43){
      ch = "B";
    }else if(t1 < 50){
      ch = "C";
    }else if(t1 < 55){
      ch = "D";
    }else if(t1 < 70){
      ch = "E";
    }else ch = "NA";
    cout << ch << endl;
  }
  return 0;
}

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

int h[] = {35, 37, 40, 43, 50, 55, 70};
int f[] = {71, 77, 83, 89, 105, 116, 148};
string s[] = {"AAA", "AA", "A", "B", "C", "D", "E"};

int main()
{
  double a, b;
  while(cin >> a >> b)
  {
    for(int i = 0; i < 7; i++)
    {
      if(a < h[i] && b < f[i])
      {
        cout << s[i] << endl;
        goto next;
      }
    }
    cout << "NA\n";
  next:;
  }
}

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

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int N, K;

bool cmp(const pii &a, const pii &b){
    if(a.first == b.first) return a.second < b.second;
    return a.first < b.first;
}

struct Edge {
    int to, cost;
    Edge(int to, int cost): to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

const int INF = 100000000;

vi dist;
int d[110][110];

bool bellman_ford(int n, int s) { // nは頂点数、sは開始頂点
    dist = vector<int>(n, INF);
    dist[s] = 0; // 開始点の距離は0
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int u = 0; u < n; u++) {
                if (dist[v] != INF && dist[u] > dist[v] + d[v][u]) {
                    dist[u] = dist[v] + d[v][u];
                    if (i == n - 1) return true; // n回目にも更新があるなら負の閉路が存在
                }
            }
        }
    }
    return false;
}

int main() {
    //cout << fixed << setprecision(15);

    double a, b;
    while(cin >> a >> b){
        a *= 100;
        b *= 100;
        if(a<3550 && b < 7100){
            cout << "AAA" << endl;
        }else if(a < 3750 && b < 7700){
            cout << "AA" << endl;
        }else if(a < 4000 && b < 8300) {
            cout << "A" << endl;
        }else if(a < 4300 && b < 8900) {
            cout << "B" << endl;
        }else if(a < 5000 && b < 10500) {
            cout << "C" << endl;
        }else if(a < 5500 && b < 11600) {
            cout << "D" << endl;
        }else if(a < 7000 && b < 14800) {
            cout << "E" << endl;
        }else cout << "NA" << endl;
    }
    return 0;
}