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 (not(f a)&&a/=0)&&f b then "YYMM" else if f a&&(not(f b)&&b/=0) then "MMYY" else "NA"