s = gets.chomp

left_is_mm = (1..12).member?(s[0..1].to_i)
right_is_mm = (1..12).member?(s[2..3].to_i)

ans = ''
if left_is_mm
  if right_is_mm
    ans = 'AMBIGUOUS'
  else
    ans = 'MMYY'
  end
else
  if right_is_mm
    ans = 'YYMM'
  else
    ans = 'NA'
  end
end

puts(ans)