N = gets.chomp.split("").map(&:to_i)

if N[0]==0 && N[1]!=0
  first = true
elsif (N[0]==1)&&(N[1]<=2)
  first = true
else
  first = false
end

if N[2]==0 && N[3]!=0
  second = true
elsif (N[2]==1)&&(N[3]<=2)
  second = true
else
  second = false
end

if first && second
  puts "AMBIGUOUS"
elsif first && !second
  puts "MMYY"
elsif !first && second
  puts "YYMM"
else
  puts "NA"
end