n = gets.split("").map(&:to_i)
count = 0
if n[0]*10+n[1] == 0
elsif n[0]*10+n[1] > 12
else
  count += 1
end
if n[2]*10+n[3] == 0
elsif n[2]*10+n[3] > 12
else
  count += 2
end

if count == 0
  puts "NA"
elsif count == 1
  puts "MMYY"
elsif count == 2
  puts "YYMM"
elsif count == 3
  puts "AMBIGUOUS"
end
