n = gets.chomp.split('')
a = (n[0] + n[1]).to_i
b = (n[2] + n[3]).to_i
## &&
ans = "NA"
if (a >= 1 && a <= 12) && (b >= 1 && b <= 12)
  ans = "AMBIGUOUS"
else
  ans = "YYMM" if b >= 1 && b <= 12
  ans = "MMYY" if a >= 1 && a <= 12
end

puts ans