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

ans :: String -> String
ans s
  | elem h2 month && elem l2 month = "AMBIGUOUS"
  | elem h2 month && elem l2 year = "MMYY"
  | elem h2 year && elem l2 month = "YYMM"
  | otherwise = "NA"
  where
    h2 = take 2 s
    l2 = drop 2 s
    month = ["01","02","03","04","05","06","07","08","09","10","11","12"]
    year = "00" : month ++ (map show [13..99])