program bbb
implicit none

integer :: s, i, j

read*, s
i=s/100
j=s-i*100

if(i==0.or.j==0) then
write(*,'(a2)') 'NA'
return
end if

if(i<=12.and.j<=12) write(*,'(a9)') 'AMBIGUOUS'
if(i<=12.and.j>12) 	write(*,'(a4)') 'MMYY' 
if(i>12.and.j<=12) 	write(*,'(a4)') 'YYMM'
if(i>12.and.j>12) 	write(*,'(a2)') 'NA'

end program