program main
Implicit None
	integer(8)::s
	
	read*,s
	if(s/100 > 12 .or. s < 100)then
		if(mod(s,100) > 12 .or. mod(s,100) == 0)then
			print"(a)","NA"
			else
			print"(a)","YYMM"
		endif
		else
		if(mod(s,100) > 12)then
			print"(a)","MMYY"
			else
			print"(a)","AMBIGUOUS"
		endif
	endif
end program main