data Rank = AAA | AA | A | B | C | D | E | NA deriving (Show,Eq,Ord)

main :: IO ()
main = do
  ls <- getContents
  let ls' = map (map read) (map words  (lines ls))
  mapM_ print $ solve ls'

solve :: [[Double]] -> [Rank]
solve [] = []
solve ([x,y]:r) = (max (check1 x) (check2 y)):(solve r)
  where
    check1 :: Double -> Rank
    check1 d
      | d < 35.50 = AAA
      | d < 37.50 = AA
      | d < 40.00 = A
      | d < 43.00 = B
      | d < 50.00 = C
      | d < 55.00 = D
      | d < 70.00 = E
      | otherwise = NA
    check2 :: Double -> Rank
    check2 d
      | d < 71.00 = AAA
      | d < 77.00 = AA
      | d < 83.00 = A
      | d < 89.00 = B
      | d < 105.00 = C
      | d < 116.00 = D
      | d < 148.00 = E
      | otherwise = NA