program main
	implicit none
	character(100) S
	read(*, *) S
	if(S(3:4) > "00" .AND. S(1:2) > "00" .AND. S(1:2) <="12" .AND. S(3:4) <= "12") then
		write(*, *) "AMBIGUOUS"
	else if(S(1:2) > "00" .AND. S(1:2) <="12") then
		write(*, *) "MMYY"
	else if(S(3:4) > "00" .AND. S(3:4) <="12") then
		write(*, *) "YYMM"
	else
		write(*, *) "NA"
	end if
end program main