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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double m5,m10;
  while(cin>>m5>>m10){
    if(m5 < 35.50 && m10 < 71.0){
      cout << "AAA"<<endl;
    }
    else if(m5 < 37.50 && m10 < 77.0){
      cout << "AA"<<endl;
    }
    else if(m5 < 40.0 && m10 < 83.0){
      cout << "A"<<endl;
    }
    else if(m5 < 43.0 && m10 < 89.0){
      cout << "B" <<endl;
    }
    else if(m5 < 50.0 && m10 < 105.0){
      cout << "C"<<endl;
    }
    else if(m5 < 55.0 && m10 < 116.0){
      cout << "D"<<endl;
    }
    else if(m5 < 70.0 && m10 < 148.0){
      cout << "E"<<endl;
    }
    else cout << "NA"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main(void){
	double s, l;
	int s_r, l_r;
	int res;
	
	
	while(cin >> s >> l){
		if(s < 35.5){
			s_r = 0;
		}else if(s < 37.5){
			s_r = 1;
		}else if(s < 40){
			s_r = 2;
		}else if(s < 43){
			s_r = 3;
		}else if(s < 50){
			s_r = 4;
		}else if(s < 55){
			s_r = 5;
		}else if(s < 70){
			s_r = 6;
		}else{
			s_r = 7;
		}
		if(l < 71){
			l_r = 0;
		}else if(l < 77){
			l_r = 1;
		}else if(l < 83){
			l_r = 2;
		}else if(l < 89){
			l_r = 3;
		}else if(l < 105){
			l_r = 4;
		}else if(l < 116){
			l_r = 5;
		}else if(l < 148){
			l_r = 6;
		}else{
			l_r = 7;
		}
		
		res = max(s_r, l_r);
		
		switch(res){
			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;
			case 7:
				cout << "NA" << endl;
				break;
		}
	}
}

C++: #include<stdio.h>
int main()
{
	double a,b;
	while(scanf("%lf%lf",&a,&b)!=EOF){
		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<stdio.h>
 
int main(){
     
    double s,m;
     
    while( scanf("%lf",&s) != EOF ){
        scanf("%lf",&m);
         
        while(1){
            if(s<35.50 && m<71.00){
                printf("AAA\n");
                break;
            }
            else if(s<37.50 && m<77.00){
                printf("AA\n");
                break;
            }
            else if(s<40.00 && m<83.00){
                printf("A\n");
                break;
            }
            else if(s<43.00 && m<89.00){
                printf("B\n");
                break;
            }
            else if(s<50.00 && m<105.00){
                printf("C\n");
                break;
            }
            else if(s<55.00 && m<116.00){
                printf("D\n");
                break;
            }
            else if(s<70.00 && m<148.00){
                printf("E\n");
                break;
            }
            else if(s>=70.00 || m>=148.00){
                printf("NA\n");
                break;
            }
        }
    }
     
return 0;
}

C++: #include<iostream>
using namespace std;
string s[8]={"AAA","AA","A","B","C","D","E","NA"};
double a[8]={35.5 , 37.5 , 40.0 , 43.0, 50.0, 55.0, 70.0,9999999.9999999};
double b[8]={71.0 , 77.0 , 83.0 , 89.0,105.0,116.0,148.0,9999999.9999999};
double q,w;
int main(){
  while(cin>>q>>w){
    for(int i=0;i<8;i++){
      if(q<a[i]&&w<b[i]){
	cout<<s[i]<<endl;
	break;
}}}}

C++: #include<iostream>

using namespace std;

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

	
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double EPS = 1e-10;

// a < b;
bool LE(const double a, const double b) {
	return (a < b + EPS);
}

int main() {
	string name[8] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
	double m500[8] = {35.50, 37.50, 40.00, 43.00, 50.00, 55.00, 1 * 60 + 10, 100000000};
	double m1000[8] = {1 * 60 + 11, 1 * 60 + 17, 1 * 60 + 23, 1 * 60 + 29, 1 * 60 + 45, 1 * 60 + 56, 2 * 60 + 28, 100000000};
#if 0
	for(int i = 0; i < 7; i++) {
		cout << name[i] + ":" << m500[i] << ":" << m1000[i] << endl;
	}
#endif
	
	for(double a, b; cin >> a >> b;) {
		int i = 0;
		while(LE(m500[i], a) || LE(m1000[i], b)) i++;
		cout << name[i] << endl;
	}
}