def canM n
  n <= 12 && n >= 1
end
s = gets.to_i
a = s / 100
b = s % 100
puts "AMBIGUOUS" if canM(a) && canM(b)
puts "NA" if !canM(a) && !canM(b)
puts "YYMM" if !canM(a) && canM(b)
puts "MMYY" if canM(a) && !canM(b)