def main()
        stdin = gets.chomp.split('')
        f = (stdin[0]+stdin[1]).to_i
        b = (stdin[2]+stdin[3]).to_i
        frag_f = 13>f && f>0 ? true : false
        frag_b = 13>b && b>0 ? true : false
        
        if frag_f
                if frag_b # t t
                        print "AMBIGUOUS"
                else # t f
                        print "MMYY"
                end
        else
                if frag_b # f t
                        print "YYMM"
                else # f f
                        print "NA"
                end
        end

end
main()