def valid_month?(a)
  a != 0 && a <= 12
end

S = gets.chomp.to_i
a = S / 100
b = S % 100

if valid_month?(a)
  if valid_month?(b)
    puts "AMBIGUOUS"
  else
    puts "MMYY"
  end
else
  if valid_month?(b)
    puts "YYMM"
  else
    puts "NA"
  end
end

