def lscan;gets.split.map(&:to_i);end

s = gets.chomp

l = s[0..1]
r = s[2..3]

yymm = (1..12).cover?(r.to_i)
mmyy = (1..12).cover?(l.to_i)

if yymm && mmyy
  puts "AMBIGUOUS"
elsif yymm
  puts "YYMM"
elsif mmyy
  puts "MMYY"
else
  puts "NA"
end