main :: IO ()
main = do
  (pr, sf) <- splitAt 2 <$> getLine :: IO (String, String)
  putStrLn $ case (pr `elem` months, sf `elem` months) of
    (True, True) -> "AMBIGUOUS"
    (True, False) -> "MMYY"
    (False, True) -> "YYMM"
    (False, False) -> "NA"

months :: [String]
months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
