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