solve s1 s2
 | s1 && s2       = "NA"
 | (not s1) && s2 = "MMYY"
 | s1 && (not s2) = "YYMM"
 | otherwise      = "AMBIGUOUS"

main = do
 s <- getLine
 let s1 = (\x -> x > 12) $ read $ take 2 s
 let s2 = (\x -> x > 12) $ read $ drop 2 s
 putStr $ if(((take 2 s) == "00") || ((drop 2 s) == "00")) then "NA" else solve s1 s2