S = gets.chomp.to_i

if S/100 > 0 && S/100 < 13
  if S%100 > 0 && S%100 < 13
    puts "AMBIGUOUS"
  else
    puts "MMYY"
  end
else
  if S%100 > 0 && S%100 < 13
    puts "YYMM"
  else
    puts "NA"
  end
end