s = gets.chomp                                                                                                                                                                                                                                                                 

a = s[0..1].to_i
b = s[2..3].to_i

if a == 0
  if b == 0
    puts "NA"
  elsif (1..12).member? b
    puts "YYMM"
  else
    puts "NA"
  end
elsif (1..12).member? a
  if b == 0
    puts "MMYY"
  elsif (1..12).member? b
    puts "AMBIGUOUS"
  else
    puts "MMYY"
  end
else
  if b == 0
    puts "NA"
  elsif (1..12).member? b
    puts "YYMM"
  else
    puts "NA"
  end
end