s = gets.strip.split("").map(&:to_i)

s1 = (s[0].to_s+s[1].to_s).to_i
s2 = (s[2].to_s+s[3].to_s).to_i

if 1 <= s1 && s1 <= 12 && 1 <= s2 && s2 <= 12
  puts "AMBIGUOUS"
elsif 1 <= s1 && s1 <= 12
  puts "MMYY"
elsif 1 <= s2 && s2 <= 12
  puts "YYMM"
else
  puts "NA"
end