def monthable? number
  (1..12).include? number
end

s = gets.chomp
former = s.slice(0..1).to_i
latter = s.slice(2..3).to_i

if monthable? former
  if monthable? latter
    puts "AMBIGUOUS"
  else
    puts "MMYY"
  end
else
  if monthable? latter
    puts "YYMM"
  else
    puts "NA"
  end
end