main :: IO()
main = do
    s <- getLine
    let f = read $ take 2 s
    let b = read $ drop 2 s
    if 1 <= f && f <=12
        then do
            if 1 <= b && b <= 12
                then do
                    putStr "AMBIGUOUS"
            else do
                putStr "MMYY"
    else do
        if 1 <= b && b <= 12
            then do
                putStr "YYMM"
        else do
            putStr "NA"