module Main where

import           Control.Monad
import           Data.Array.IO
import           Data.Char
import           Data.List
import           Data.List.Split
import           Data.Ord
import qualified Data.Vector.Unboxed as V
import           Text.Printf

main :: IO ()
main = do
  s <- getLine
  let f = read $ take 2 s :: Int
      t = read $ drop 2 s :: Int
      yymm = f >= 0 && f < 99 && t > 0 && t < 13
      mmyy = f > 0 && f < 13 && t >= 0 && t < 99
  if yymm && mmyy
    then putStrLn "AMBIGUOUS"
    else if yymm
         then putStrLn "YYMM"
         else if mmyy
              then putStrLn "MMYY"
              else putStrLn "NA"




