main :: IO ()
main = do
  s <- getLine
  putStrLn $ solve s

solve :: String -> String
solve [a,b,c,d]
  | 0 < x && x <= 12 && 0 < y && y <= 12 = "AMBIGUOUS"
  | 0 < x && x <= 12                     = "MMYY"
  | 0 < y && y <= 12                     = "YYMM"
  | otherwise                            = "NA"
  where
    x = read [a, b]
    y = read [c, d]