f n=if n>=1&&n<=12 then True else False
main=do
 s<-getLine
 let a=read(take 2 s):: Int
     b=read(drop 2 s):: Int
 putStrLn$if f a&&f b then "AMBIGUOUS" else if f b then "YYMM" else if f a then "MMYY" else "NA"