import           Control.Monad
import           Control.Applicative
import           Data.List
import qualified Data.Map                      as M
--import qualified Data.Vector as V
--import qualified Data.Vector.Mutable as VM

-- getBysplit = map read . words <$> getLine

main :: IO ()
main = do
  [a, b, c, d] <- getLine
  let yymm = "01" <= [c, d] && [c, d] <= "12"
  let mmyy = "01" <= [a, b] && [a, b] <= "12"
  if yymm && mmyy
    then putStrLn "AMBIGUOUS"
    else if yymm && not mmyy
      then putStrLn "YYMM"
      else if not yymm && mmyy then putStrLn "MMYY" else putStrLn "NA"
