main = do
    (a : b : c : d : _) <- getLine
    let x = read [a, b] :: Int
    let y = read [c, d] :: Int
    putStrLn $ solve x y

solve x y
    | 1 <= x && x <= 12 && 1 <= y && y <= 12 = "AMBIGUOUS"
    | 1 <= x && x <= 12 = "MMYY"
    | 1 <= y && y <= 12 = "YYMM"
    | otherwise = "NA"