S = gets.chomp
f, l = S[0,2].to_i, S[2,2].to_i

if f.between?(1,12)
  if l.between?(1,12)
    puts "AMBIGUOUS"
  else
    puts "MMYY"
  end
else
  if l.between?(1,12)
    puts "YYMM"
  else
    puts "NA"
  end
end