program main
implicit none
integer :: i
integer :: yymm, mmyy

yymm = 1
mmyy = 1
read(*,*) i
if(i/100 >12 .or. i/100 <1 ) then
   mmyy = 0
end if
if( mod(i,100) == 0 .or. mod(i,100) == 19 ) then
   yymm = 0
end if

if( mmyy == 1 ) then
   if ( yymm == 1 ) then
      write(*,*) 'AMBIGUOUS'
   else
      write(*,*) 'MMYY'
   end if
else
   if ( yymm == 1 ) then
      write(*,*) 'YYMM'
   else
      write(*,*) 'NA'
   end if
end if



end program main
