main = do
  s <- getLine
  let n = [read (take 2 s),read (drop 2 s)]
  putStrLn $ f (map m n)
m x
  | x >= 1 && x <= 12 = 1
  | otherwise = 0
f y
  | head y == 1 && last y == 1 = "AMBIGUOUS"
  | head y == 1 && last y == 0 = "MMYY"
  | head y == 0 && last y == 1 = "YYMM"
  | otherwise = "NA"