#include <bits/stdc++.h>
using namespace std;
string color(char str) {
  if (str == 'Y') return "Y";
  if (str == 'M') return "M";
  if (str == 'C') return "C";
  return "A";
}
int main() {
  int n, count = 0;
  scanf("%d", &n);
  char str[n];
  for (int i(0); i < n; ++i) {
    cin >> str[i];
    if (str[i] == '?') count++;
  }
  for (int i(0); i < n; ++i)
    if (str[i] == str[i + 1] && str[i] != '?') {
      printf("NO\n");
      return 0;
    }
  for (int i(0); i < n; ++i) {
    if (str[i] == '?') {
      if (color(str[i - 1]) == color(str[i + 1]) || color(str[i - 1]) == "A" ||
          color(str[i + 1]) == "A") {
        printf("YES\n");
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
