yearformat s
  | month s && month s100 = "AMBIGUOUS"
  | month s = "YYMM"
  | month s100 = "MMYY"
  | otherwise = "NA"
  where
    s100 = s `div` 100
    month i = 1 <= i `mod` 100 && i `mod` 100 <= 12

main = do
  s <- readLn
  putStrLn $ yearformat s