s=gets.chomp
first=s[0..1].to_i
second=s[2..3].to_i
if first==0 || second==0
  puts "NA"
elsif first>12 && second<13
  puts "YYMM"
elsif first<13 && second>12
  puts "MMYY"
elsif first<13 && second<13
  puts "AMBIGUOUS"
else
  puts "NA"
end
