module Main where

import Data.List
import Control.Monad
import Debug.Trace

isM :: String -> Bool
isM "01" = True
isM "02" = True
isM "03" = True
isM "04" = True
isM "05" = True
isM "06" = True
isM "07" = True
isM "08" = True
isM "09" = True
isM "10" = True
isM "11" = True
isM "12" = True
isM _ = False

solve :: String -> String
solve s = if isYYMM && isMMYY then
        "AMBIGOUS"
        else if isYYMM then "YYMM"
        else if isMMYY then "MMYY"
        else "NA"
    where
    first = take 2 s
    second =  take 2 $ drop 2 s
    isYYMM = isM second
    isMMYY = isM first

main = do
    s <- getLine
    putStrLn $ solve s