main :: IO ()
main = do
    s <- getLine :: IO String
    let d01 = read $ take 2 s
        d23 = read $ drop 2 s
    putStrLn $ case (1 <= d01 && d01 <= 12, 1 <= d23 && d23 <= 12) of
        (True , True ) -> "AMBIGUOUS"
        (True , False) -> "MMYY"
        (False, True ) -> "YYMM"
        _              -> "NA"
