main = do
  (s:_) <- words <$> getLine
  putStrLn $ yymmormmyy s

yymmormmyy s
  | (s1 >= "01" && s1 <= "12") && (s2 >= "01" && s2 <= "12") = "AMBIGUOUS"
  | not (s1 >= "01" && s1 <= "12") && not (s2 >= "01" && s2 <= "12") = "NA"
  | (s1 >= "01" && s1 <= "12") && not (s2 >= "01" && s2 <= "12") = "MMYY"
  | not (s1 >= "01" && s1 <= "12") && (s2 >= "01" && s2 <= "12") = "YYMM"
  where
   s1 = take 2 s
   s2 = drop 2 s