main :: IO ()
main = do
    [a,b,c,d] <- getLine
    let fs = read [a,b]
    let sn = read [c,d]
    let res = case (betw fs, betw sn) of
                (True,True) -> "AMBIGUOUS"
                (True,False) -> "MMYY"
                (False,True) -> "YYMM"
                _ -> "NA"
    putStrLn res

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

