S = gets.chomp

a = S[0, 2].to_i
b = S[2, 2].to_i
if a == 0
  if b > 12 || b == 0
    puts "NA"
  else
    puts "YYMM"
  end
elsif a <= 12
  if b > 12 || b == 0
    puts "MMYY"
  else
    puts "AMBIGUOUS"
  end
else
  if b > 12 || b == 0
    puts "NA"
  else
    puts "YYMM"
  end
end