s = gets.to_i

first = s/100
last = s%100

if 0 < first && first < 13 && 0 < last && last < 13
  puts "AMBIGUOUS"
elsif 0 < first && first < 13
  puts "MMYY"
elsif 0 < last && last < 13
  puts "YYMM"
else
  puts "NA"
end