import Control.Applicative
import Control.Monad
import Data.Functor
import Data.List

readInts = map read . words <$> getLine :: IO [Int]

solve s
  | month x && month y = "AMBIGUOUS"
  | month x = "MMYY"
  | month y = "YYMM"
  | otherwise = "NA"
  where
    month c = let n = read c in n>=1 && n <= 12
    (x, y) = splitAt 2 s


main = getLine >>= putStrLn . solve
