import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  s <- getLine
  putStrLn $ checkYM s

checkYM [a1,a2,b1,b2]
  |"01"<=aa && aa<="12" && "01"<=bb && bb<="12" = "AMBIGUOUS"
  |"01"<=aa && aa<="12"                         = "MMYY"
  |"01"<=bb && bb<="12"                         = "YYMM"
  |otherwise                                    = "NA"
    where aa = [a1,a2]
          bb = [b1,b2]