
main=do
  (a,b)<-splitAt 2<$>getLine
  let (x,y) = (read a,read b)
  putStr $ solve x y

solve x y
  | invalid x && invalid y = "NA"
  | invalid x = "YYMM"
  | invalid y = "MMYY"
  | otherwise = "AMBIGUOUS"

invalid x = x > 12 || x == 0