import Data.Char

main = do
  s <- getLine
  let a = ((read . take 2) s) `elem` [1..12]
  let b = ((read . drop 2) s) `elem` [1..12]
  putStrLn $ if a && b then "AMBIGUOUS" else if a then "MMYY" else if b then "YYMM" else "NA"