main = do
  s <- read <$> getLine
  let a = div s 100
  let b = mod s 100
  putStrLn $ func a b

func :: Int -> Int -> String
func a b
  | (a < 1) || (a > 12) = if (b > 0) && (b <= 12)
                             then "YYMM"
                             else "NA"
  | (a > 0) && (a <= 12) = if (b > 0) && (b <= 12)
                             then "AMBIGUOUS"
                             else "MMYY"
