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

year = (0..99).to_a
month = (1..12).to_a

if month.include?(s1) && month.include?(s2)
  puts "AMBIGUOUS"
elsif year.include?(s1) && month.include?(s2)
  puts "YYMM"
elsif month.include?(s1) && year.include?(s2)
  puts "MMYY"
else
  puts "NA"
end
