string = gets.chomp
first_i = string[0..1].to_i
last_i = string[2..3].to_i
if first_i > 12
  if last_i == 0 || last_i > 12
    puts "NA"
  else
    puts "YYMM"
  end
elsif first_i == 0
  if 0 < last_i && last_i < 13
    puts "YYMM"
  else
    puts "NA"
  end
else
  if last_i == 0
    puts "MMYY"
  elsif last_i < 13
    if last_i == 0
      puts "NA"
    else
      puts "AMBIGUOUS"
    end
  else
    puts "MMYY"
  end
end