main :: IO()
main = do
    str <- getLine
    putStrLn $ getsolve (isMonth (take 2 str)) (isMonth (drop 2 str))

getsolve :: Bool -> Bool -> String
getsolve True True 	= "AMBIGUOUS"
getsolve True False	= "MMYY"
getsolve False True	= "YYMM"
getsolve False False= "NA"

isMonth :: String -> Bool
isMonth str
    | str == "01"		= True
    | str == "02"		= True
    | str == "03"		= True
    | str == "04"		= True
    | str == "05"		= True
    | str == "06"		= True
    | str == "07"		= True
    | str == "08"		= True
    | str == "09"		= True
    | str == "10"		= True
    | str == "11"		= True
    | str == "12"		= True
    | otherwise			= False