main = do
  s <- getLine
  putStrLn $ f s 

f :: String -> String
f xs
  | inc (take 2 xs) && inc (drop 2 xs) = "AMBIGUOUS"
  | inc (take 2 xs) = "MMYY"
  | inc (drop 2 xs) = "YYMM"
  | otherwise = "NA"
  where
    inc x = x `elem` ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]