s = gets.to_i
u = s % 100
t = s / 100
if (t <= 12 && t >= 1) && (u <= 12 && u >= 1)
  ans = "AMBIGUOUS"
elsif (u <= 12) && (u >= 1)
  ans = "YYMM"
elsif (t <= 12) && (t >= 1)
  ans = "MMYY"
else
  ans = "NA"
end
puts ans