import Data.List (sort)
import Data.Char (toLower)

readIntLine :: IO ([Int])
readIntLine = do
    x <- getLine
    return $ map (read :: String -> Int) $ words x

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

format :: String -> String
format s =
    let p1 = (read :: String -> Int) $ take 2 s
        p2 = (read :: String -> Int) $ drop 2 s
      in if ok p1 then if ok p2 then "AMBIGUOUS"
                                else "MMYY"
                  else if ok p2 then "YYMM"
                                else "NA"

ok :: Int -> Bool
ok x = x > 0 && x < 13
