s=readline
a = s[0..2].to_i
b = s[2..4].to_i
if 1 <= a and a <= 12
  if 1 <= b and b <= 12
    puts "AMBIGUOUS"
  else
    puts "MMYY"
  end
else
  if 1 <= b and b <= 12
    puts "YYMM"
  else
    puts "NA"
  end
end