import Control.Applicative

main :: IO ()
main = solve <$> readLn >>= putStrLn

solve :: Int -> String
solve x = case (m a, m b) of
  (True, True) -> "AMBIGUOUS"
  (True, False) -> "MMYY"
  (False, True) -> "YYMM"
  _ -> "NA"
  where
    (a, b) = divMod x 100
    m n = n >= 1 && n <= 12
