program cc
  implicit none
  integer :: s,flag1,flag2
  flag1 = 0
  flag2 = 0
  read *, s
  if (0<mod(s,100) .and. mod(s,100)<13) flag1 = 1
  if (0<s/100 .and. s/100<13) flag2 = 1
  if (flag1 == 1 .and. flag2 == 1) then
    print '(a)', "AMBIGUOUS"
  else if (flag1 == 1) then
    print '(a)', "YYMM"
  else if (flag2 == 1) then
    print '(a)', "MMYY"
  else
    print '(a)', "NA"
  end if
  stop
end program cc
