main = do
    s <- getLine
    let l = read $ take 2 s
    let r = read $ drop 2 s
    putStrLn $ if r > 0 && r <=12 && l > 0 && l <=12
                    then "AMBIGUOUS"
               else if r > 0 && r <=12
                    then "YYMM"
               else if l > 0 && l <=12
                    then "MMYY"
               else "NA"
