import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString.Lazy.Builder as BLB
import Data.List
import Data.Int
import Data.Char
import Text.Printf

main = do
    s <- getLine
    putStrLn $ solve s

mmCandidates :: [String]
mmCandidates = [printf "%02d" (i :: Int32) | i <- [1..12]]

mightNotMm :: String -> Bool
mightNotMm s = not $ elem s mmCandidates

solve :: String -> String
solve s
    | (mightNotMm forward) && (mightNotMm backward) = "NA"
    | (mightNotMm forward) = "YYMM"
    | (mightNotMm backward) = "MMYY"
    | otherwise = "AMBIGUOUS"
    where forward = take 2 s
          backward = drop 2 s