S = gets.chomp.to_i
a = S/100
b = S%100
p [a,b]
if 12<a || a==0 then
	if 12>=b && b>=1 then
		print'YYMM'
	else
		print 'NA'
	end
else
	if 12<b || b==0 then
		print 'MMYY'
	else
		print 'AMBIGUOUS'
	end
end