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
else
  if last_i < 13
    puts "AMBIGUOUS"
  else
    pusts "MMYY"
  end
end