Overlooking the captivating blend of myriads of vernal hues, Arkady the painter lays out a long, long canvas.Arkady has a sufficiently large amount of paint of three colours: cyan, magenta, and yellow. On the one-dimensional canvas split into n consecutive segments, each segment needs to be painted in one of the colours.Arkady has already painted some (possibly none or all) segments and passes the paintbrush to you. You are to determine whether there are at least two ways of colouring all the unpainted segments so that no two adjacent segments are of the same colour. Two ways are considered different if and only if a segment is painted in different colours in them.

The first line contains a single positive integer n (1 ≤ n ≤ 100) — the length of the canvas. The second line contains a string s of n characters, the i-th of which is either 'C' (denoting a segment painted in cyan), 'M' (denoting one painted in magenta), 'Y' (one painted in yellow), or '?' (an unpainted one).

If there are at least two different ways of painting, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower).

NoteFor the first example, there are exactly two different ways of colouring: CYCMY and CYMCY.For the second example, there are also exactly two different ways of colouring: CMCMY and CYCMY.For the third example, there are four ways of colouring: MCYCM, MCYCY, YCYCM, and YCYCY.For the fourth example, no matter how the unpainted segments are coloured, the existing magenta segments will prevent the painting from satisfying the requirements. The similar is true for the fifth example.

# cook your code here
useless = raw_input()
s = raw_input()
if (('MM' in s) or ('CC' in s) or ('YY' in s)):
    print "No"
elif ( ('??' in s) or ('M?M' in s) or ('C?C' in s) or ('Y?Y' in s) or (s[0] == '?') or (s[len(s)-1] == '?')):
    print "Yes"
else:
    print "No"

n=int(input())
s=str(input())
flag=0
for i in range(0,len(s)-1):
    if(s[i]==s[i+1] and s[i]!='?'):
        flag=1
if(flag==1):
    print('NO')
elif(flag==0):
    if(s[0]=='?' or s[-1]=='?'):
        print('YES')
    else:
        flags=0
        for j in range(0,len(s)):
            if(s[j]=='?'):
                d=set()
                if(s[j+1]!='?'):
                    d.add(s[j+1])
                if(s[j-1]!='?'):
                    d.add(s[j-1])
                if(len(d)==1):
                    print('YES')
                    flags=1
                    break
        if(flags==0):
            print('NO')

n=input()
s=input()
if s.count("CC") or s.count("MM") or s.count("YY"):
    print("No")
elif(s[0]=='?' or s[-1]=='?'):
    print("Yes")
elif s.count("??"):
    print("Yes")
else:
    b=''
    q=0
    for i in s:
        if(i!='?'):
            if((q>0 and b==i)):
                print("Yes")
                break
            q=0
            b=i

        else:
            q+=1
    else:
        print("No")

t = input()
a = list(input())
i=0
maxm =1
n =len(a)
while i<n:
    if a[i] == '?':
        if i == 0 or i == n-1:
            maxm = 2
        elif i+1<n:
            if a[i+1] == '?':
                maxm = 2
            elif i>=1:
                if a[i+1] == a[i-1] :
                    maxm = 2
    elif i<n-1:
        if a[i] == a[i+1]:
            maxm =3
            break
    i = i+1
if a[0]=='?' and n==1:
    maxm=2
if maxm ==2:
    print('Yes')
else:
    print('No')

import sys

n = int(input())
string1 = input()
string2 = string1
array = ['C','Y','M']
flag = 1
for i in range(0, len(string2)-1):
	if(string2[i] != "?" and string2[i] == string2[i+1]):
		print("No")
		sys.exit()
if(string2[0] == "?" or string2[len(string2)-1] == "?"):
	print("Yes")
	sys.exit()

for i in range(1, len(string2)-1):
	if(string2[i] == '?'):
		if(string2[i-1] == string2[i+1] or string2[i+1] == "?"):
			flag = 0
			break

if(flag == 1):
	print("No")
else:
	print("Yes")

n = int(input())
s = input()
if(s.find('CC')!=-1 or s.find('YY')!=-1 or s.find('MM')!=-1):
    print('No')
elif(s.find("??")!=-1):
    print("Yes")
else:
    c = 0
    p = []
    f = 0
    for i in range(len(s)):
        if(s[i]=="?"):
            p.append(i)
    for y in p:
        if(y==0 or y==n-1):
            print("Yes")
            f = 1
            break
        else:
            if(s[y-1]==s[y+1]):
                c+=2
                break
    if(c>=2 and f!=1):
        print("Yes")
    elif(c<2 and f!=1):
        print("No")

n = input()
s = raw_input()
if 'CC' in s or 'MM' in s or 'YY' in s:
	print "No"
elif '??' in s or "C?C" in s or "M?M" in s or "Y?Y" in s or s[0] == '?' or s[-1] == '?':
	print "Yes"
else:
	print "No"

n = int(input())
s = list(input())
k = 0
idx = -1
possible = False
for i in range(n):
    if s[i] == '?':
        k += 1
        idx = i
    else:
        if i < n - 1:
            if s[i] == s[i + 1]:
                possible = False
                break
        if k > 1:
            possible = True
        elif k == 1:
            if idx == 0:
                possible = True
            else:
                if s[idx - 1] == s[idx + 1]:
                    possible = True
        k = 0
if idx == n - 1:
    possible = True
if possible:
    print("Yes")
else:
    print("No")

if __name__ == '__main__' :
	n = input()
	s = raw_input().strip()
	flag, i = 0, 0
	while i < n-1 :
		if s[i] != "?" and s[i] == s[i+1] :
			flag = 1
			break
		i += 1
	if flag == 1 or s == "C" or s == "Y" or s == "M" or "?" not in s:
		print "No"
	else :
		i = 0
		c = 0
		p = 0
		f = -1
		while i <= n :
			#print s[i]
			if i < n and s[i] == "?" :
				c += 1
				p += 1
			else :
				if f < c :
					f = c
				#print c, f
				c = 0

			i += 1

		if f == 1 :
			e = 0
			for i in range (n) :
				if s[i] == "?" :
					if i-1 >= 0 and i+1 < n and s[i-1] != s[i+1]:
						e += 1
			if e == p :
				print "No"
			else :
				print "Yes"

		else :
			print "Yes"

n = int(input())
s = input()

def f(s):
    for i in range(len(s) - 1):
        if s[i] != '?':
            if s[i] == s[i + 1]:
                return False
    for i in range(len(s)):
        if s[i] == '?':
            if i == 0 or i == len(s) - 1:
                return True
            else:
                if s[i + 1] == '?':
                    return True
                if s[i - 1] == s[i + 1]:
                    return True
    return False

if f(s):
    print("Yes")
else:
    print("No")

import re
smem = {}
dmem = {}

def S(n):
	global smem
	if n == 0: return 1
	if n in smem:
		return smem[n]
	smem[n] = 2 * D(n - 1)
	return smem[n]

def D(n):
	global dmem
	if n == 0: return 1
	if n == 1:return 1
	elif n == 2: return 3
	if n in dmem:
		return dmem[n]
	dmem[n] = 2 * D(n - 1) + S(n - 1)
	return dmem[n]

n = int(input())
s = input()
L = [(m.start(0),m.end(0)-1) for m in re.finditer("[?]+", s)]

res = []
for a, b in L:
	# Categorize
	l = b - a + 1
	if a == 0:
		if b == n - 1:
			# no chars
			print("Yes")
			exit()
		else:
			# has a char
			res.append(2 ** l)
	elif b == n - 1:
		if a == 0:
			# no chars
			print("Yes")
			exit()
		else:
			# has a char
			res.append(2 ** l)
	else:
		# somewhere in between
		if s[a - 1] != "?":
			if s[b + 1] != "?":
				# both surrounded by chars
				if s[a-1]==s[b+1]:
					# same on both sides
					res.append(S(l))
				else:
					# different
					res.append(D(l))

for a,b in zip(s,s[1:]):
	if a == "?":
		continue
	if a == b:
		print("No")
		exit()

real = 1
for x in res:
	real *= x
if real < 2:
	print("No")
else:
	print("Yes")

x=int(input())
y=input()
for i in range (len(y)-1):
    if y[i+1]==y[i] and y[i] != '?':
        print("No")
        exit()

alist=[]
for i in range (1,len(y)-2):
    if y[i]== '?' and y[i-1]!= '?' and y[i+1]!= '?':
        alist.append(i)
    elif y[i]== '?' and y[i+1]== '?' :
        print("yes")
        exit()

if '?' in y :

    if y[0] == '?' or y[len(y)-1]=='?':
        print("yes")
        exit()
    for i in alist :
        if y[i-1]==y[i+1] :
            continue
        else:
            print("No")
            exit()

    print("Yes")

else:
    print("No")

n=input()
s=raw_input()
if 'CC' in s or 'MM' in s or 'YY' in s:
	print 'NO'
elif '??' in s:
	print 'YES'
elif 'C?C' in s or 'M?M' in s or 'Y?Y' in s or s[0]=='?' or s[n-1]=='?':
	print 'YES'
else:
	print 'NO'

n = int(input())
a = input()
a = list(a)

t=0

g =a.count("?")

if g==0:
	print("No")
	exit()

for i in range(n-1):
	j = i+1
	if (a[i]==a[j] and a[i]!="?") :
		print("No")
		exit()
for i in range(1,n-1):
	if a[i-1]!=a[i+1] and a[i]=="?" and (a[i-1]!="?" and a[i+1]!="?" ):
		t+=1

if t>=g and t!=0:
	print("no")
	exit()
print("Yes")

#k=int(input())
#n,m=map(int,input().split())
import sys

#a=list(map(int,input().split()))

#b=list(map(int,input().split()))
import math

def YES():
    print("YES")
    sys.exit()

def NO():
    print("NO")
    sys.exit()

n=int(input())

a=input()

for i in range(n-1):
    if a[i]==a[i+1] and a[i]!='?':
        print("NO")
        sys.exit()

for i in range(n):
    if a[i]=='?':
        if i+1<n and a[i]=='?' and a[i+1]==a[i]:
            YES()

        if i==0 or i==n-1:
            YES()

        if i-1>=0 and i+1<n and a[i-1]==a[i+1]:
           YES()

NO()

print("YES" if (cnt>1 or q>1) else "NO")

n, s = int(input()), 'A' + input() + 'B'

for i in range(1, n + 1):
    if s[i] in 'CMY' and s[i] == s[i + 1]:
        print('No')
        break
else:
    if s[1] == '?' or s[n] == '?' or '??' in s:
        print('Yes')
    else:
        for i in range(1, n + 1):
            if s[i] == '?' and s[i - 1] == s[i + 1]:
                print('Yes')
                break
        else:
            print('No')

#from collections import Counter,defaultdict
#get= lambda : map(int,input().split())
import re
input()
s=input()
if re.findall('C{2,}|M{2,}|Y{2,}',s):
        print ("No")
        exit()
if s.startswith('?') or s.endswith('?'):
        print("Yes")
        exit()
s=' '+s+' '

l=0

for i,j in enumerate(s):
        if '?'==j:
                l+=1
        else:
                if l==1:
                        if  s[i-2]==s[i]:
                                print("Yes")
                                break
                if l>=2:
                        print("Yes")
                        break
                l=0
else:
        print("No")
#http://codeforces.com/problemset/problem/957/A

import sys
xrange = range
input = raw_input

n = int(input())
S = [c for c in input()]
for i in range(1,n):
    if S[i-1]!='?' and S[i]!='?' and S[i]==S[i-1]:
        print('No')
        sys.exit()
for i in range(1,n):
    if S[i-1]=='?' and S[i]=='?':
        print('Yes')
        sys.exit()
if S[-1]=='?' or S[0]=='?':
    print('Yes')
    sys.exit()
for i in range(1,n-1):
    if S[i-1]==S[i+1] and S[i]=='?':
        print('Yes')
        sys.exit()
print('No')

#s = 'CMY'
#D = {}
#D['C']=0
#D['M']=1
#D['Y']=2
#locked = ['?'==S[i] for i in range(n)]
#
#if S[0]=='?':
#    pos[0] = 1
#else:
#    pos[0] = 0
#for i in range(1,n):
#    if S[i]=='?':
#        temp = pos[i-1][:]
#        temp = [1-t for t in ]

n = int(input())
s = input()

numberOfways = 1
for i in range(n-1):
    if (s[i] == '?'):
        if (i == 0):
            if (s[i+1] == '?'):
                numberOfways *= 3
            else:
                numberOfways *= 2
        elif (s[i-1] == s[i+1] or (s[i-1] != '?' and s[i+1] == '?')):
            numberOfways *= 2
    else:
        if (s[i+1] == s[i]):
            numberOfways *= 0
        else:
            pass
    if (i == n-2 and s[i+1] == '?'):
        numberOfways *= 2

if (n == 1 and s[0] == '?'):
    numberOfways = 3
if (numberOfways > 1):
    print('Yes')
else:
    print('No')

n = int(input())
s = input()
if s.count('MM') > 0 or s.count('CC') > 0 or s.count('YY') > 0 or s.count('?') == 0:
    print('No')
else:
    if s.count('??') > 0 or s[0] == '?' or s[-1] == '?':
        print('Yes')
    else:
        for i in range(1, n - 1):
            if s[i] == '?':
                if s[i - 1] == s[i + 1]:
                    print('Yes')
                    exit()
            if i == n - 2:
                print('No')

n = int(input())
s = input()
for i in range(n - 1):
    if s[i] == s[i + 1] != '?':
        print('NO')
        break
else:
    for i in range(n):
        if s[i] == '?':
            if i != 0 and i != n - 1 and s[i - 1] != s[i + 1] and s[i - 1] != '?' and s[i + 1] != '?':
                continue
            print('YES')
            break
    else:
        print('NO')

n = int(input())
s = input()

if ((s.find('??') >= 0 or s[0] == '?' or s[-1] == '?'
    or any(s.find(c + '?' + c) >= 0 for c in ['C', 'M', 'Y']))
    and all(s.find(x) < 0 for x in ['CC', 'MM', 'YY'])):
    print("Yes")
else:
    print("No")

n=input()
s=raw_input()
for x in ['CC','YY','MM']:
    if x in s:
        print 'No'
        exit()
if '??' in s or "C?C" in s or "M?M" in s or "Y?Y" in s or s[0] == '?' or s[-1] == '?':
    print "Yes"
else:
    print "No"

n=int(input())
a=input()
def check(n,a):
    for i in range(n-1):
        if a[i]==a[i+1] and a[i]!='?':
            return False
    return True
l=[]
c=0
for i in range(n):
    if a[i]=='?':
        c=c+1
    l.append(a[i])
k=0
for i in range(n-2):
    if a[i+1]=='?' and a[i]==a[i+2]:
        k=1
if check(n,l)==False:
    print('No')
    k=2
def main(l,n):
    t=[]
    for i in l:
        b=i.index('?')
        q=[]
        r=[]
        s=[]
        for j in range(b):
            q.append(i[j])
            r.append(i[j])
            s.append(i[j])
        q.append('Y')
        r.append('C')
        s.append('M')
        if 1==1:
            for j in range(b+1,n):
                q.append(i[j])
                r.append(i[j])
                s.append(i[j])
        if check(n,q)==True:
            t.append(q)
        if check(n,r)==True:
            t.append(r)
        if check(n,s)==True:
            t.append(s)
    return t
if k==1:
    print('Yes')
if k==0:
    l=[l]
    for i in range(c):
        l=main(l,n)
    d=0
    for i in l:
        if check(n,i)==True:
            if d==1:
                print('Yes')
            d=d+1
    if d==0 or d==1:
        print('No')

li=lambda:(map(int,raw_input().strip().split()))
ni=lambda:(int(raw_input()))
si=lambda:(raw_input())
import math
from collections import Counter
n=ni()
r=si()
l=len(r)
g=1
for i in range(0,l-1):
    if r[i]==r[i+1]:
        if r[i]=="?":
            continue
        else:
            print "No"
            exit(0)
i=0
if r[i]=="?" or r[l-1]=="?":
    print "Yes"
    exit(0)
for i in range(1,l-2):
    if r[i]=="?":
        if r[i-1]!=r[i+1] and r[i-1]!="?" and r[i+1]!="?":
            g=1
        else:
            g=2
            print "Yes"
            exit(0)
            break
if g==1:
    print "No"

n = int(input())
s = input()
ans = 0
for i in range(n):
    if (i<n-1 and s[i]==s[i+1]=='?'):
        ans = 1
    if (s[i]=='?' and (i==0 or i==n-1 or s[i-1]==s[i+1])):
        ans = 1
for i in range(n-1):
    if (s[i]==s[i+1] and s[i]!='?'):
        ans = 0
if (ans==1):
        print("Yes")
else:
    print("No")

n=input()
s=raw_input()
c='?'
l=s.count(c)
yes='Yes'
no='No'
if l==0:
    print no
    exit()
for i in range(1,n):
    if s[i]==s[i-1] and s[i]!=c:
        print no
        exit()

if '??' in s:
    print yes
    exit()
if s[0]==c or s[-1]==c:
    print yes
    exit()
if ('M?M' in s ) or ('C?C' in s )or ('Y?Y' in s):
    print yes
    exit()
print no

def checker(paints: str) -> bool:
    limit = len(paints) - 1
    i = 1
    while i < limit:
        if paints[i] == '?' and paints[i - 1] != '?' and paints[i + 1] != '?' and paints[i - 1] != paints[i + 1]:
            paints = paints[:i] + paints[i + 1:]
            limit -= 1

        i += 1

    for i in range(0, len(paints) - 1):
        if paints[i] == paints[i + 1] and paints[i] != '?' and paints[i + 1] != '?':
            return False

    return "?" in paints

lengthOfTheCanvas = int(input())
paints1 = input()
if checker(paints1):
    print("Yes")
else:
    print("No")

"""
________        _____________              ______
___  __ \____  ____  __ \__(_)__   _______ ___  /
__  /_/ /_  / / /_  /_/ /_  /__ | / /  __ `/_  /
_  ____/_  /_/ /_  _, _/_  / __ |/ // /_/ /_  /
/_/     _\__, / /_/ |_| /_/  _____/ \__,_/ /_/
        /____/

https://github.com/Cheran-Senthil/PyRival
Copyright (c) 2018 Cheran Senthilkumar
"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
import sys
from atexit import register
from bisect import bisect_left, bisect_right

# import random
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    from io import BytesIO as stream
    # from fractions import Fraction
    # from fractions import gcd
    # from cPickle import dumps
    # from Queue import PriorityQueue, Queue
else:
    from io import StringIO as stream
    # from functools import reduce
    # from fractions import Fraction
    # from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        def items(self):
            return dict.iteritems(self)

        def keys(self):
            return dict.iterkeys(self)

        def values(self):
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """
    Sets whether the standard Python streams are allowed to buffer their I/O.

    Parameters
    ----------
    sync : bool, optional
        The new synchronization setting. Default is True.
    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    s = input()
    prev = '!'
    for i in s:
        if i == prev:
            if i != '?':
                print('No')
                exit()
        prev = i
    if (s[0] == '?') or (s[-1] == '?'):
        print('Yes')
        exit()
    for i in range(1, n - 1):
        if s[i] == '?':
            if (s[i - 1] == '?') or (s[i + 1] == '?'):
                print('Yes')
                exit()
            if s[i - 1] == s[i + 1]:
                print('Yes')
                exit()
    print('No')

if __name__ == '__main__':
    sys.setrecursionlimit(10000)
    sync_with_stdio()
    main()

n = input()
s = raw_input()
if 'CC' in s or 'MM' in s or 'YY' in s:
	print "No"
elif '??' in s or "C?C" in s or "M?M" in s or "Y?Y" in s or s[0] == '?' or s[-1] == '?':
	print "Yes"
else:
	print "No"

n = int(input())
s = input()
ind = True
ind1 = False
y = []
for i in s:
	y.append(i)
for i in range(n):
	if (y[i] == "?" and i == 0) or (y[i] == "?" and i == n - 1) or (y[i] == "?" and y[i - 1] == y[i + 1]) or (y[i] == "?" and (y[i - 1] == "?" or y[i + 1])) == "?":
		ind1 = True
	if i > 0 and (y[i] == y[i - 1] and y[i] != "?"):
		ind = False
		break
if ind and ind1:
	print("Yes")
else:
	print("No")

from itertools import accumulate
def rs(): return input().rstrip()
def ri(): return int(rs())
def ra(): return list(map(int, rs().split()))

n = ri()
arr = list(rs())

for a, b in zip(arr, arr[1:]):
    if (a == b) and (a != "?"):
        print("No")
        exit()

for num, item in enumerate(arr):
    if item == "?":
        if (num == 0) or (num == len(arr)-1):
            print("Yes")
            exit()

        if arr[num-1] == arr[num+1]:
            print("Yes")
            exit()

        if arr[num-1] == "?":
            print("Yes")
            exit()

        if arr[num+1] == "?":
            print("Yes")
            exit()
else:
    print("No")

raw_input()
s = raw_input().strip()

if len(s) == 1 and s[0] == '?':
    print 'Yes'
    exit(0)

if s.find('CC') != -1 or s.find('YY') != -1 or s.find('MM') != -1:
    print 'No'
    exit(0)

for i in xrange(len(s)):
    if i > 0 and s[i] == s[i - 1]:
        print 'Yes'
        exit(0)

    cnt = i == 0
    cnt += i == len(s) - 1
    if s[i] == '?':
        if cnt > 0 or s[i - 1] == s[i + 1]:
            # if i == len(s) - 1 or s[i - 1] == s[i + 1]:
            print 'Yes'
            exit(0)
print 'No'

#codeforces_957A_live
n = int(input())
si = input()
flag = True
if "MM" in si or "CC" in si or "YY" in si or not("?" in si):
	print("No")
elif "???" in si or "??" in si:
	print("Yes")
elif si.startswith("?") or si.endswith("?"):
	print("Yes")
else:
	for k in range(n):
		if si[k] == "?" and si[k-1] == si[k+1]:
			print("Yes")
			flag = False
			break;
	if flag :
		print("No")

n=input()
s=raw_input()
if 'CC' in s or 'MM' in s or 'YY' in s:
	print 'NO'
elif '??' in s:
	print 'YES'
elif 'C?C' in s or 'M?M' in s or 'Y?Y' in s or s[0]=='?' or s[n-1]=='?':
	print 'YES'
else:
	print 'NO'

_,s = input(),input()
print('Yes' if
    ('??' in s or 'C?C' in s or 'M?M' in s or 'Y?Y' in s or s[0] == '?' or s[-1] == '?') and
    not ('CC' in s or 'MM' in s or 'YY' in s)
else 'No')

n = int(input())
string = input()

indices = []

for i in range(n):
    if string[i] == '?':
        indices.append(i)

colors = ['C', 'Y', 'M']

def check_if_no():
    check = False
    for i in range(1, n):
        if string[i] == '?':
            continue
        if string[i] == string[i - 1]:
            check = True
            break
    return check

def boundary_check():
    if (0 in indices) or (len(string) - 1 in indices):
        return True
    return False

def adjacent_empty():
    check = False
    for i in range(1, len(indices)):
        if indices[i] - indices[i - 1] == 1:
            check = True
            break
    return check

def same_adjacent():
    check = False
    for i in indices:
        if string[i - 1] == string[i + 1]:
            check = True
            break
    return check

if check_if_no():
    print("No")

elif boundary_check():
    print("Yes")

elif adjacent_empty():
    print("Yes")

elif same_adjacent():
    print("Yes")

else:
    print("No")

input()
s=input()
if 'MM' in s or 'CC' in s or 'YY' in s or '?' not in s:
    print('No')
    exit()
t=s.count('C?Y')+s.count('C?M')+s.count('Y?M')
t+=s.count('Y?C')+s.count('M?Y')+s.count('M?C')
if t==s.count('?'):
    print('No')
    exit()
print('Yes')

n = int(input())
str = input()

for i in range(len(str) - 1):
    if str[i] == str[i + 1] and str[i] != '?':
        print("No")
        exit(0)

if str[0] == '?' or str[-1] == '?' or '??' in str or 'M?M' in str or 'C?C' in str or 'Y?Y' in str:
    print("Yes")
else:
    print("No")

n = int(input())
s = input()
cl = ['M', 'C', 'Y']
res = True
count = s.count('?')
for i in range(1, n-1):
    if (s[i]!='?' and s[i-1]!='?' and s[i-1]==s[i]) or (s[i]!='?' and s[i+1]!='?' and s[i]==s[i+1]):
        res = False
        break
    if s[i-1]!='?' and s[i+1]!='?' and s[i-1]!=s[i+1] and s[i]=='?':
        count-=1

if count==0 : res = False
if res: print('Yes')
else: print('No')

n = int(input())
s = input()
for i in range(n - 1):
  if s[i] == s[i + 1] != '?':
    print('No')
    exit(0)
for i in range(1, n - 1):
  if s[i] == '?' and len(set([s[i - 1], s[i + 1]])&set("CYM")) != 2:
    print('Yes')
    exit(0)
if s[0] == '?' or s[-1] == '?':
  print('Yes')
  exit(0)
print('No')

# -*- coding: utf-8 -*-
# @Time    : 2018/3/29 20:35
# @Author  : Yunjie Cao
# @FileName: A.py
# @Software: PyCharm
# @Email   ：Cyj19970823@gmail.com

import re

def solve():
    n = input()
    s = input()
    if (('??'in s or 'C?C' in s or 'Y?Y' in s or 'M?M' in s or s[0]=='?' or s[-1]=='?') and 'CC' not in s and 'YY' not in s and 'MM' not in s):
        print("YES")
    else:
        print("NO")

if __name__=="__main__":
    solve()

n = input()
s = input()

def say_no():
    print("No")
    exit(0)

def say_yes():
    print("Yes")
    exit(0)

for i in range(1, len(s)):
    if s[i]==s[i-1] and s[i] != '?':
        say_no()

for i in range(1, len(s)-1):
    if s[i]=='?' and (s[i-1]==s[i+1] or s[i-1]=='?' or s[i+1]=='?'):
        say_yes()

if s[0]=='?' or s[len(s)-1]=='?':
    say_yes()

say_no()

n = int(input())
s = input()
for i in range(n - 1):
    if s[i] == s[i + 1] != '?':
        print('NO')
        break
else:
    for i in range(n):
        if s[i] == '?':
            if i != 0 and i != n - 1 and s[i - 1] != s[i + 1] and s[i - 1] != '?' and s[i + 1] != '?':
                continue
            print('YES')
            break
    else:
        print('NO')

# cook your dish here
from sys import stdin,stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I=lambda: map(int,stdin.readline().split())
I1=lambda: stdin.readline()

n=int(I1())
s=I1().strip()
i,f=0,0
for j in range(1,n):
    if s[j]==s[j-1] and s[j]!='?':
        print('No')
        exit()
while i<n:
    if s[0]=='?' or s[n-1]=='?':
        f=1
        break
    elif s[i]=='?':
        j=i+1
        while s[j]=='?':j+=1
        if(s[i-1]==s[j]) or(s[i-1]!=s[j] and j-i>1):
            f=1
            break
    i+=1
if f==1: print("Yes")
else : print("No")

n=int(input())
s=input()
for i in range(n-1):
    if s[i]==s[i+1] and s[i]!="?":
        print("NO")
        quit()
ans="No"
for i in range(n-1):
    if s[i]==s[i+1]=="?":
        ans="YES"
        break
    elif s[i]=="?":
        if i==0 or (s[i-1]==s[i+1]):
            ans="YES"
            break
if s[n-1]=="?": ans="YES"
print(ans)

l = int(raw_input())
s = raw_input()

# check set
flag = 1
checks = 0
prev = ""
for i in s:
    if checks:
        if i == prev and prev!="?":
            flag = 0
            break
        prev = i
    if i!="?" and not checks:
        checks = 1
        prev = i
# fin two ways beach

if not flag :
    print("NO")
else:
    if "??" in s or s[0]=="?" or s[-1]=="?":
        print("YES")
    elif len(s) in [1,2]:
        print("NO")
    else:
        checks = ["M?M","Y?Y","C?C"]
        for i in checks:
            if i in s:
                print("YES")
                exit(0)
        print("NO")

n = int(input())
s = input()
def yes():
    print('YES')
    exit()
def no():
    print('NO')
    exit()

if s.find('YY') >= 0: no()
if s.find('CC') >= 0: no()
if s.find('MM') >= 0: no()

if s.find('???') >= 0 or s.find('??') >= 0:
    yes()
if s.find('C?C') >= 0: yes()
if s.find('M?M') >= 0: yes()
if s.find('Y?Y') >= 0: yes()
if s[0] == '?' or s[-1] == '?': yes()

no()

import sys
canvas_size = int(input())
canvas = input()

next_possibilities = "CMY"

possible = False
if canvas[0] == '?' or canvas[-1] == '?':
    possible = True

for i, color in enumerate(canvas[1: len(canvas)-1]):
    i += 1
    if color == '?':
        if canvas[i-1] == '?' or canvas[i+1] == '?' or canvas[i-1] == canvas[i+1]:
            possible = True

if not possible:
    print("No")
    sys.exit()

last_color = canvas[0]
for color in canvas[1:]:
    if color == last_color and color != '?':
        print("No")
        sys.exit()
    last_color = color

print("Yes")

import math
from decimal import Decimal
def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return n,b

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return n,b,c

def dv():
	n, m = map(int, input().split())
	return n,m

def dva():
	n, m = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return n,m,b

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return n,b,m,c

def dvs():
	n = int(input())
	m = int(input())
	return n, m

n = int(input())
s = input()
k = 0
tk = 0
if n == 1 and s[0] == '?':
	print('YES')
	exit()
for i in range(n - 1):
	if s[i] == '?':
		k += 1
	if s[i] == '?' and i > 0 and s[i - 1] != s[i + 1] and s[i-1] != '?' and s[i+1] != '?':
		tk += 1
	if s[i] == s[i + 1] and s[i] != '?':
		print('NO')
		exit()
if s[n - 1] == '?':
	k += 1
if k == tk:
	print('NO')
else:
	print('YES')

n = int(input())
a = input()

flag = 0
for ind, a_i in enumerate(a):
    if ind == 0:
        continue
    else:
        if a_i == a[ind - 1] and a_i != '?':
            flag = 1
            break

if flag == 1:
    print('No')
else:
    if a.count('?') >= 2:
        flag = 0
        for ind, a_i in enumerate(a):
            if ind != 0 and ind != n - 1:
                if a_i == '?' and a[ind - 1] == a[ind + 1] or a_i == '?' and (a[ind - 1] == '?' or a[ind + 1] == '?'):
                    flag = 1
                    break
            elif ind == 0 and a_i == '?' or ind == n - 1 and a_i == '?':
                flag = 1
                break
        print('Yes' if flag == 1 else 'No')
    else:
        if a.count('?') == 0:
            print('No')
        else:
            ind = a.index('?')
            if ind == 0 or ind == n - 1:
                print('Yes')
            else:
                if a[ind - 1] == a[ind + 1]:
                    print('Yes')
                else:
                    print('No')

x = int(input())
myStr = input()

def func(myStr):
	choice = 0
	n = len(myStr)
	for i, c in enumerate(myStr):
		if c != '?':
			if i + 1 < n:
				if c == myStr[i + 1]:
					return False
					break
		elif c == '?' and choice < 2:
			if i + 1 < n:
				if c == myStr[i + 1]:
					choice += 2
				else:
					if i - 1 < 0 :
						choice += 2
					else:
						if myStr[i - 1] == myStr[i + 1]:
							choice += 2
						else:
							continue
			else:
				choice += 2

	if choice >= 2:
		return True
	else:
		return False

z = func(myStr)
if z == True:
	print('Yes')
else:
	print('No')

n = int(input())
a = input()
for i in range(1, len(a)):
    if a[i] == a[i-1] and a[i-1] != '?':
        print('No')
        exit()
for i in range(1, len(a)-1):
    if a[i] == '?' and ((a[i-1] == a[i+1]) or (a[i-1] == a[i] or a[i+1] == a[i])):
        print('Yes')
        exit()
if a[0] == '?' or a[-1] == '?':
    print('Yes')
    exit()
print('No')

import sys
sys_in = sys.stdin

def read_ints():
    return map(lambda x: int(x), sys_in.readline().split())

def read_int():
    return int(sys_in.readline())

N = read_int()
line = sys_in.readline().strip()

possible_colors = [None]*N
for i in range(N):
    c = line[i]
    if c != '?':
        possible_colors[i] = set([c])
        if i > 0:
            try:
                possible_colors[i-1].remove(c)
            except KeyError:
                pass
    else:
        possible_colors[i] = set(['C', 'M', 'Y'])
        if i > 0:
            if len(possible_colors[i-1]) == 1:
                possible_colors[i].remove(list(possible_colors[i-1])[0])
    if len(possible_colors[i]) == 0:
        sys.stdout.write("No\n")
        exit(0)

for i in range(N-1, 0, -1):
    if len(possible_colors[i]) == 0:
        sys.stdout.write("No\n")
        exit(0)
    if len(possible_colors[i]) == 1:
        try:
            possible_colors[i-1].remove(list(possible_colors[i])[0])
        except KeyError:
            pass

for i in range(N):
    if len(possible_colors[i]) == 0:
        break
    if len(possible_colors[i]) >= 2:
        sys.stdout.write("Yes\n")
        exit(0)

sys.stdout.write("No\n")

n = int(input())
s = list(input())

def main():
    if '?' not in s:
        print('No')
        return

    for i in range(1,n):
        j = i-1
        if (s[i] == s[j]) and (s[i] != '?'):
            print('No')
            return

    if n == 1:
        print('Yes')
        return

    if s[0]=='?' or s[n-1]=='?':
        print('Yes')
        return

    for i in range(1,n):
        j = i-1
        if s[i] == s[j]:
            print('Yes')
            return

    for i in range(2,n):
        i_1 = i-1
        i_2 = i-2
        if (s[i_2] == s[i]) and  s[i_1]=='?':
            print('Yes')
            return

    print('No')
    return

main()

n = int(input())
s = input()

# Case where we can't use two coloring :
# 1) no "?" present
# 2) X?Y Case
# 3) X??X S'il existe des suites

ans = "Yes"
no_int = s.count("?")

def is_cool(s):
    if s.count("??"):
        return True
    else:
        a = s.count("C?C") + s.count("M?M") + s.count("Y?Y")
        return a > 0

ok = (s.count("MM") + s.count("CC") + s.count("YY")) == 0
# print("ok : ", ok)

if n == 1:
    if s == "?":
        ans = "Yes"
    else:
        ans = "No"
else:

    if not (ok):
        ans = "No"
    elif no_int == 0:
        ans = "No"
    elif s[0] == "?" or s[-1] == "?":
        ans = "Yes"
    elif s.count("M?C") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("M?Y") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("C?M") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("C?Y") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("Y?C") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("Y?M") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"

print(ans)

n=int(input())
s=input()
cont=0
x=s[0]
t=False
t1=True
if x=='?':
    t=True
for i in range(1,n):
    if s[i]==s[i-1] and s[i]!='?':
        t1=False
        break
    if (s[i]=='?' and i+1!=n and s[i-1]==s[i+1]) or (s[i-1]=='?' and s[i]=='?') or (s[i]=='?' and i+1==n) :
        t=True
if t== True and t1==True:
    print("Yes")
else:
    print("No")

n=int(input())
s=input()
if ('MM' in s) or ('CC' in s) or ('YY' in s):
    print('No')
else:
    if (s[0]=='?') or (s[-1]=='?'):
        print('Yes')
    else:
        if '??' in s:
            print('Yes')
        else:
            if ('C?C' in s) or ('M?M' in s) or ('Y?Y' in s):
                print('Yes')
            else:
                print('No')

import re
input()
s=input()
print('No'if re.search('CC|MM|YY',s)or not('?'in(s[0],s[-1])or'??'in s
or re.search(r'(C|M|Y)\?(\1)',s))else'Yes')

n = int(input());
s = input();

def f():
	for i in range(n-1):
		if s[i] == s[i+1] and s[i] != "?":
			return False
	if "??" in s:
		return True
	if "C?C" in s or "M?M" in s or "Y?Y" in s:
		return True
	if s[0] == "?" or s[n-1] == "?":
		return True
	return False

if f():
	print("Yes")
else:
	print("No")

n = int(raw_input())
s = raw_input()
dup = False
two = False
if s[0] == '?' or s[-1] == '?':
    two = True

for i in range(1, len(s)):
    if s[i] != '?' and s[i-1] != '?' and s[i] == s[i-1]:
        dup = True
    if s[i] == '?' and s[i-1] == '?':
        two = True
    if i < len(s) - 1 and s[i] == '?' and s[i-1] != '?' and s[i+1] != '?' and s[i-1] == s[i+1]:
        two = True

if dup:
    print "No"
elif two:
    print "Yes"
else:
    print "No"

n  = input()
s  = raw_input()
ok = 1
for i in range(n):
	if i + 1 < n and s[i] == s[i+1] and s[i] != '?' and s[i+1] != '?':
		ok = 0
		break
if ok == 0:
	print 'No'
else:
	ok = 0
	for i in range(n):
		if s[i] != '?':
			continue
		if i == 0:
			ok = 1
		else:
			if i == n - 1:
				ok = 1
			else:
				j = i
				while j < n:
					if s[j] == '?':
						j = j + 1
					else:
						break
				j = j - 1
				if i == j:
					if s[i-1] == s[i+1]:
						ok = 1
				else:
					ok = 1
	if ok == 1:
		print 'Yes'
	else:
		print 'No'

n = int(input())
str = input()

for i in range(len(str) - 1):
    if str[i] == str[i + 1] and str[i] != '?':
        print("No")
        exit(0)

if str[0] == '?' or str[-1] == '?' or '??' in str or 'M?M' in str or 'C?C' in str or 'Y?Y' in str:
    print("Yes")
else:
    print("No")

n = int(input())
s = input()
ans = 0
for i in range(n):
    if (i<n-1 and s[i]==s[i+1]=='?'):
        ans = 1
    if (s[i]=='?' and (i==0 or i==n-1 or s[i-1]==s[i+1])):
        ans = 1
for i in range(n-1):
    if (s[i]==s[i+1] and s[i]!='?'):
        ans = 0
if (ans==1):
        print("Yes")
else:
    print("No")

n = int(input())
s = input()
if n == 1:
	if s == '?':
		print("yes")
	else:
		print("no")
	quit()
for i in range(1, n):
	if s[i] == s[i - 1] and s[i] != '?':
		print("no")
		quit()
if s[0] == '?':
    print("yes")
    quit()
for i in range(1, n):
	if s[i] == '?':
		if i == n - 1 or s[i - 1] == s[i + 1] or s[i - 1] == '?' or s[i + 1] == '?':
			print("yes")
			quit()
print("no")

n=int(input())
s=input()
f=1
for i in range(n-1):
    if s[i]==s[i+1] and s[i]!='?' and s[i+1]!='?':
        f=0
        break
if f==0:
    print('No')
else:
    ms=set()
    if '??' in s:
        print('Yes')
    else:
        if s[0]=='?' or s[-1]=='?':
            print('Yes')
        elif 'C?C' in s:
            print('Yes')
        elif 'M?M' in s:
            print('Yes')
        elif 'Y?Y' in s:
            print('Yes')
        else:
            print('No')

# -*- coding: utf-8 -*-
# @Time    : 2018/3/29 20:35
# @Author  : Yunjie Cao
# @FileName: A.py
# @Software: PyCharm
# @Email   ：Cyj19970823@gmail.com

import re

def solve():
    n = input()
    s = input()
    if (('??'in s or 'C?C' in s or 'Y?Y' in s or 'M?M' in s or s[0]=='?' or s[-1]=='?') and 'CC' not in s and 'YY' not in s and 'MM' not in s):
        print("YES")
    else:
        print("NO")

if __name__=="__main__":
    solve()

n = int(input())
t = input()
b = True
for i in range(len(t)-1):
    if t[i]==t[i+1] and t[i]!='?':
        b = False
        break
if not b:
    print("No")
else:
    b = False
    if t[0]=='?' or t[len(t)-1]=='?':
        b = True
    for i in range(1, len(t)-1):
        if t[i]=='?' and (t[i-1]==t[i+1] or t[i-1]=='?' or t[i+1]=='?'):
            b = True
    if b:
        print("Yes")
    else:
        print("No")

from functools import reduce
N=int(input())
colors  = input()
def compare(x, y):
    if  x==False  or x == y and  ( x=="C" or x=="M" or x=="Y"):
            return False
    return y

def check_for(colors):
    if colors[0]=="?" or colors[-1]=="?":
        return True
    for i in range(1, len(colors)-1):
        if colors[i] == "?" and (colors[i-1] == colors[i+1] or colors[i+1] =="?"):

            return True

    return False

def logic(colors):
    print("Yes") if reduce(compare, colors) and check_for(colors) else print("No")

logic(colors)

import math
from fractions import Fraction

def modInverse(a, m) :

	g = gcd(a, m)

	if (g != 1) :
		print("Inverse doesn't exist")

	else :
		res = power(a, m - 2, m)
		return res

# To compute x^y under modulo m
def power(x, y, m) :

	if (y == 0) :
		return 1

	p = power(x, y // 2, m) % m
	p = (p * p) % m

	if(y % 2 == 0) :
		return p
	else :
		return ((x * p) % m)

# Function to return gcd of a and b
def gcd(a, b) :
	if (a == 0) :
		return b

	return gcd(b % a, a)

def modulo(a, m):
	return (a%m+m)%m

def matrix_square(A, mod):
    return mat_mult(A,A,mod)

def mat_mult(A,B, mod):
  if mod is not None:
    return [[modulo(A[0][0]*B[0][0] + A[0][1]*B[1][0], MOD), modulo((A[0][0]*B[0][1] + A[0][1]*B[1][1]), MOD)],
            [modulo((A[1][0]*B[0][0] + A[1][1]*B[1][0]), MOD), modulo((A[1][0]*B[0][1] + A[1][1]*B[1][1]), MOD)]]

def matrix_pow(M, power, mod):
    #Special definition for power=0:
    if power <= 0:
      return M

    powers =  list(reversed([True if i=="1" else False for i in bin(power)[2:]])) #Order is 1,2,4,8,16,...

    matrices = [None for _ in powers]
    matrices[0] = M

    for i in range(1,len(powers)):
        matrices[i] = matrix_square(matrices[i-1], mod)

    result = None

    for matrix, power in zip(matrices, powers):
        if power:
            if result is None:
                result = matrix
            else:
                result = mat_mult(result, matrix, mod)

    return result

def power(x, y, p) :
    res = 1     # Initialize result

    # Update x if it is more
    # than or equal to p
    x = x % p

    while (y > 0) :

        # If y is odd, multiply
        # x with result
        if ((y & 1) == 1) :
            res = (res * x) % p

        # y must be even now
        y = y >> 1      # y = y/2
        x = (x * x) % p

    return res
'''
for _ in xrange(int(raw_input())):
	l, d, t = map(int, raw_input().split())
	MOD = 1000000007

	if(t==1):
		print d
		continue

	fib_matrix = [[2*d,l],[-l,0]]

 	res = matrix_pow(fib_matrix, t-1, MOD)
	num = modulo((d*res[0][0]-l*res[0][1]), MOD)

	denom = power(l, t-1, MOD)

	k = gcd(num, denom)
	num/=k
	denom/=k

	num = modulo(num, MOD)
	denom = modInverse(denom, MOD)
	print modulo(num*denom, MOD)
'''

def inp(): return input()

def inpv(): return [float(x) for x in raw_input().split()]

def Hills():
	n = inp()
	s = raw_input()
	print('Yes' if
    	('??' in s or 'C?C' in s or 'M?M' in s or 'Y?Y' in s or s[0] == '?' or s[-1] == '?') and
    	not ('CC' in s or 'MM' in s or 'YY' in s)
	else 'No')

Hills()

def f(s,n):
    for i in range(n-1):
        if s[i] == s[i+1] and s[i] != '?':
            return 'No'
    if s[0] == '?' or s[-1] == '?':
        return ('Yes')
    for i in range(1,n-1):
        if s[i] == '?':
            if s[i-1] == s[i+1] or s[i-1] == '?' or s[i+1] == '?':
                return 'Yes'
    return 'No'

n = int(input())
s = input()
print(f(s,n))

n=int(input())
s=input()
if('YY' in s or 'CC' in s or 'MM' in s):
    print("No")
else:
    f=0
    for i in range(n-1):
        if(s[i]=='?' and s[i+1]=='?'):
            f=1
            break
        elif(s[i]=='?'):
            if(i==0 or (s[i-1]==s[i+1])):
                f=1
                break
    if(s[-1]=='?'):
        f=1
    if(f==0):
        print("No")
    else:
        print("Yes")

n=input()
s=raw_input()
if 'CC' in s or 'MM' in s or 'YY' in s:
	print 'NO'
elif '??' in s:
	print 'YES'
elif 'C?C' in s or 'M?M' in s or 'Y?Y' in s or s[0]=='?' or s[n-1]=='?':
	print 'YES'
else:
	print 'NO'

def main():
    n=input()
    l=map(str," ".join(raw_input()).split())
    for i in xrange(1,n):
        if l[i]==l[i-1] and l[i]!='?':
            print "No"
            exit()
    c=0
    for i in xrange(2,n):
        if l[i-1]=='?' and l[i]!=l[i-2] and (l[i]!='?' and l[i-2]!='?'):
            c+=1
    if c==l.count('?'):
        print "No"
        exit()

    print "Yes"

main()

def process(a,n):
    for i in xrange(n-1):
        if (a[i]=='Y' and a[i+1]=='Y') or (a[i]=='M' and a[i+1]=='M') or (a[i]=='C' and a[i+1]=='C'): return 0
    for i in xrange(n-1):
        if a[i]=='?' and a[i+1]=='?': return 1
    if a[0]=='?' or a[n-1]=='?': return 1
    for i in xrange(1,n-1):
        if a[i]=='?' and a[i-1]==a[i+1]: return 1
    return 0

n= int(raw_input())
arr= str(raw_input())
if process(arr,n): print "Yes"
else: print "No"

'''input
9
C??Y?Y?MM
'''
from collections import defaultdict as df
from bisect import bisect_left as bl
import sys

n=input()
s=raw_input().strip()
ans="Yes"

if ans=="Yes":
    ans="No"
    if s[0]=="?" or s[-1]=="?":
        ans="Yes"
    for i in range(1,n-1):
        if s[i]=="?":
            if s[i+1]=="?" or s[i-1]=="?":
                ans="Yes"
            if s[i+1]==s[i-1]:
                ans="Yes"
for i in range(n-1):
    if s[i]==s[i+1]:
        if s[i]!="?" :
            ans="No"

print ans

s = raw_input()
s = raw_input()
if 'MM' in s or 'CC' in s or 'YY' in s:
    print('No')
    exit(0)
q = s.count('?')
for i in range(0, len(s)):
    if s[i] == '?':
        if i == 0 or i == len(s) - 1:
            print('Yes')
            exit(0)
        elif s[i - 1] != s[i + 1] and s[i - 1] != '?' and s[i + 1] != '?':
            q -= 1

if q > 0:
    print('Yes')
else:
    print('No')

n = int(input())
s = list(input())
k = 0
idx = -1
possible = False
for i in range(n):
    if s[i] == '?':
        k += 1
        idx = i
    else:
        if i < n - 1:
            if s[i] == s[i + 1]:
                possible = False
                break
        if k > 1:
            possible = True
        elif k == 1:
            if idx == 0:
                possible = True
            else:
                if s[idx - 1] == s[idx + 1]:
                    possible = True
        k = 0
if idx == n - 1:
    possible = True
if possible:
    print("Yes")
else:
    print("No")

n = input()
s = input()

colors = {"C","Y","M"}

def res():
    for c in colors:
        if s.find(c*2) != -1:
            return "No"

    if s[0] == "?":
        return "Yes"

    if s[len(s)-1] == "?":
        return "Yes"

    if s.find("??") != -1:
        return "Yes"

    for c in colors:
        if s.find(c+"?"+c)!=-1:
            return "Yes"

    return "No"

print(res())

n = int(input())
s = input()
for i in range(n - 1):
    if s[i] == s[i + 1] != '?':
        print('NO')
        break
else:
    for i in range(n):
        if s[i] == '?':
            if i != 0 and i != n - 1 and s[i - 1] != s[i + 1] and s[i - 1] != '?' and s[i + 1] != '?':
                continue
            print('YES')
            break
    else:
        print('NO')

a=int(input());b='!'+input()+'@';ans=1;i=1;ok=0
while i<a+1:
    if b[i]!='?' and b[i+1]!='?' and b[i]==b[i+1]:ans=0
    s = 0
    if b[i] == '?':
        for j in 'CYM':
            if j != b[i - 1] and j != b[i + 1]: s += 1
    if s>1:ok=1
    i+=1
if ans and ok:print("YES")
else:print("NO")

n = int(input())
s = list(input().strip())

for i in range(1, n):
    if s[i] != '?' and s[i-1] != '?' and s[i] == s[i-1]:
        print('No')
        exit(0)

ok = False if s[0] != '?' and s[n-1] != '?' else True
p = 1
while p+1 < n:
    while p+1 < n and s[p] != '?':
        p += 1
    q = p
    while q+1 < n and s[q] == '?':
        q += 1
    l = q - p
    if l > 1:
        ok = True
    else:
        if q+1 < n and s[p-1] == s[q]:
            ok = True
    p = q
if ok:
    print('Yes')
else:
    print('No')

n = int(input())
s = input()
ind = True
ind1 = False
y = []
for i in s:
	y.append(i)
for i in range(n):
	if y[i] == "?":
		ind1 = True
	if i > 0 and (y[i] == y[i - 1] and y[i] != "?"):
		ind = False
		break
if ind and ind1:
	print("Yes")
else:
	print("No")

n=int(input())
s=str(input())
flag=0
for i in range(0,len(s)-1):
    if(s[i]==s[i+1] and s[i]!='?'):
        flag=1
if(flag==1):
    print('')
elif(flag==0):
    if(s[0]=='?' or s[-1]=='?'):
        print('YES')
    else:
        flags=0
        for j in range(0,len(s)):
            if(s[j]=='?'):
                d=set()
                if(s[j+1]!='?'):
                    d.add(s[j+1])
                if(s[j-1]!='?'):
                    d.add(s[j-1])
                if(len(d)==1):
                    print('YES')
                    flags=1
                    break
        if(flags==0):
            print('NO')

"""
Usage:
    python solution.py < input.txt > solution_output.txt

Testing:
    pytest test_solution.py

Submit:
    Just copy and paste all the code or upload the whole file
"""
from itertools import product

def get_input_list() -> str:
    """
    Loops throw the stdio to fetch input data
    Generally used on problems with 'n' inputs

    Returns:
        raw_input_data: The input of a problem
    """
    canvas_lenght = input()
    canvas_caracters = input()

    return canvas_lenght, canvas_caracters

def get_input() -> str:
    """
    Fetch input data from stdio
    Generally used on problems with discrete inputs
    Returns:
        raw_input_data: The input of a problem
    """
    raw_input_data = ""
    raw_input_data += input()
    return raw_input_data

def solve(raw_input_data: str):
    """
    Here you solve the problem, happy coding!!
    Args:
        raw_input_data: the data you test the solution

    Returns:
        answer: the solution of the problem
    """
    chars, word = raw_input_data
    chars = int(chars)

    yes = False

    for i in range(1, chars):
        if word[i] != '?' and word[i] == word[i - 1]:
            return 'No'
        elif word[i] == '?':
            if i + 1 < chars and word[i - 1] == word[i + 1]:
                yes = True
            elif word[i - 1] == '?':
                yes = True
            elif i + 1 < chars and word[i + 1] == '?':
                yes = True
    if yes:
        return 'Yes'
    return 'No'

if __name__ == "__main__":

    while True:
        try:
            # Use this with simple inputs
            # input_data = get_input()

            # Use this with the problem have many inputs
            input_data = get_input_list()

            answer = solve(input_data)
            print(answer, end="\n")
        except:
            break

x = int(input())
myStr = input()

def func(myStr):
	choice = 0
	n = len(myStr)
	for i, c in enumerate(myStr):
		if c != '?':
			if i + 1 < n:
				if c == myStr[i + 1]:
					return False
					break
		elif c == '?' and choice < 2:
			if i + 1 < n:
				if c == myStr[i + 1]:
					choice += 2
				else:
					if i - 1 < 0 :
						choice += 2
					else:
						if myStr[i - 1] == myStr[i + 1]:
							choice += 2
						else:
							choice += 1
			else:
				choice += 2

	if choice >= 2:
		return True
	else:
		return False

z = func(myStr)
if z == True:
	print('Yes')
else:
	print('No')

a = ['M?Y', 'M?C', 'C?Y', 'C?M', 'Y?M', 'Y?C']
b = ['MM', 'CC', 'YY']
input()
s = input()
res = 'Yes'
if s.count('?') == 1:
    for i in a:
        if s.find(i) > -1:
            res = 'No'
            break
for i in b:
    if s.find(i) > -1:
        res = 'NO'
        break
print(res)

from sys import stdin

lines = stdin.readlines()
n = int(lines[0])
s = lines[1].split()[0]
a = True
b = True
summ = 0
if "?" not in s:
    print "No"
    a = False
    b = False
if b:
    for i in range(n-1):

        if s[i] == s[i+1] and s[i] != "?":
            print "No"
            a = False
            break
        elif s[i] == "?" and i>0 and (s[i-1] != s[i+1]):
            summ += 1
        elif s[i] == "?":
            summ += 1

if a == True and summ > 1:
    print "Yes"
elif summ == 1:
    print "No"

n = int(input())
s = 'T' + input() + 'T'
res = 'Yes'
flex = False
for i in range(1, n+1):
    if not flex and s[i] == '?':
        if s[i-1] == '?' or s[i+1] == '?':
            flex = True
        elif s[i-1] == s[i+1]:
            flex = True
    if s[i] != '?' and s[i] == s[i-1]:
        res = 'No'
        break
if res == 'Yes' and not flex:
    res = 'No'
print(res)

n=int(input())
for _ in range(1):
    s=input().rstrip()
    f1=True
    fl1=False
    for i in range(1,len(s)):
        if s[i] is not "?" and s[i] is s[i-1]:
            f1=False
            break
    if f1:
        #print("abc")
        if s[0] is "?" or s[len(s)-1] is "?":
            print("Yes")
            fl1=False
        elif s.count("?")==0:
            print("Yes")
            fl1=False
        else:
            f=False
            last=-1
            for i in range(len(s)):
                if s[i] is "?":
                    if not f:
                        last=i
                        f=True
                else:
                    if f:
                        l=i-last
                        if l>1:
                            print("Yes")
                            fl1=False
                            break
                        else:
                            if s[last-1] is s[i]:
                                print("Yes")
                                fl1=False
                                break
                            else:
                                fl1=True
                                #print("No")
                                #break
                            f=False

    else:
        print("No")

    if fl1:
        print("No")

n=input()
st=str(raw_input())
c=0
pp=0
ans=0
for i in range(0,len(st)-1):
  if st[i]=="?" and st[i+1]=="?":
    pp=1
for i in range(1,len(st)-1):
  if st[i]=="?":
    if st[i-1]==st[i+1]:
      c=c+1
      vl=i
  elif i<len(st)-1 and st[i]==st[i+1]:
    ans=-1
if st[0]=="?" or st[n-1]=="?" or pp==1:
  print "yes"

elif ans==-1:
  print "no"
else:
  if c>=2 :
    ans=1
  if c==1:
    if vl==0 or vl==n-1:
      ans=1
    elif st[vl-1]==st[vl+1]:
      ans=1
  if ans==1:
    print "yes"
  else:
    print "no"

n=int(input())
color = input()
c=False
q=color.count("?")

print(q)

if q<2:
	print("No")
for i in range(n):
	j=i+1
	if color[i]==color[j]:
		C = True
		break
if q<2 or C:
	print("No")
else:
	print("Yes")

n=int(input())
ch=input()
if ch.count('?')==0:
    print('NO')
else:
    if 'CC' in ch:
        print('NO')

    elif 'MM' in ch:
        print('NO')
    elif 'YY' in ch:
        print('NO')
    elif ('M?M' in ch ) or ('C?C' in ch) or ('Y?Y' in ch):
        print('YES')
    elif ('C?Y' in ch) and ('C?Y?Y' not in ch) and ('C?C?Y' not in ch):
        print('NO')
    elif ('C?M' in ch) and ('C?M?M' not in ch) and ('C?C?M'  not in ch):
        print('NO')
    elif ('M?C' in ch) and ('M?C?C' not in ch) and  ('M?M?C' not in ch):
        print('NO')
    elif ('M?Y' in ch) and ('M?Y?Y' not in ch)  and ('M?M?Y' in ch):
        print('NO')
    elif ('Y?C' in ch) and ('Y?C?C' not in ch) and ('Y?Y?C' in ch):
        print('NO')
    elif ('Y?M' in ch) and ('Y?M?M' not in ch) and ('Y?Y?M' in ch):
        print('NO')
    else:
        print('YES')

n = int(input())
s = input()
q = 0
for i in range(1,n-1):
    if s[i] != '?':
        if s[i] == s[i+1] or s[i] == s[i-1]:
            print("NO")
            exit()
    else:
        q += 1
if q == 0:
    print("NO")
    exit()
found = False
for i in range(n):
    if s[i] == '?':
        if i == 0 or i == n-1: found = True
        elif s[i-1] == '?' or s[i+1] == '?': found = True
        elif s[i-1] == s[i+1]: found = True

if(found):
    print("YES")
else:
    print("NO")

# cook your dish here
from sys import stdin,stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I=lambda: map(int,stdin.readline().split())
I1=lambda: stdin.readline()

n=int(I1())
s=I1().strip()
i,f=0,0
for j in range(1,n):
    if s[j]==s[j-1]:
        print('No')
        exit()
while i<n:
    if s[0]=='?' or s[n-1]=='?':
        f=1
        break
    elif s[i]=='?':
        j=i+1
        while s[j]=='?':j+=1
        if(s[i-1]==s[j]):
            f=1
            break
    i+=1
if f==1: print("Yes")
else : print("No")

# cook your dish here
from sys import stdin,stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I=lambda: map(int,stdin.readline().split())
I1=lambda: stdin.readline()

n=int(I1())
s=I1().strip()
i,f=0,0
for j in range(1,n):
    if s[j]==s[j-1] and s[j]!='?':
        print('No')
        exit()
while i<n:
    if s[0]=='?' or s[n-1]=='?':
        f=1
        break
    elif s[i]=='?':
        j=i+1
        while s[j]=='?':j+=1
        if(s[i-1]==s[j]):
            f=1
            break
    i+=1
if f==1: print("Yes")
else : print("No")

t = int(input())
str = list(input())
lstr = len(str)

if '?' not in str:
    print("No")
    exit()

sw2 = 0
if lstr == 1:
    print("Yes")
    exit()
if lstr == 2 and str[0] != str[1]:
    print("Yes")
    exit()
if lstr == 3 and str[1] == '?' and str[0] != str[2]:
    print("No")
    exit()
if lstr == 3 and (str[0] != str[1] and str[1] != str[2]):
    print("Yes")
    exit()

for i in range(lstr):
    if str[i] != '?':
        if i != 0 and i != lstr - 1:
            if str[i] == str[i-1] or str[i] == str[i+1]:
                print("No")
                exit()
        elif i == 0 and lstr != 1:
            if str[i] == str[i+1]:
                print("No")
                exit()
        else:
            if str[i] == str[i-1]:
                print("No")
                exit()

    else:
        if i != 0 and i != lstr - 1:
            if str[i-1] != str[i+1]:
                sw2 = 1
        else:
            sw2 = 1

if sw2:
    print("Yes")
else:
    print("No")

def is_available(picture):
    """
    :param picture: str
    :return: bool
    """
    for i, color in enumerate(picture):
        if i == 0 or color == '?':
            continue

        if color == picture[i - 1]:
            return False

    return True

n = int(input())
picture = input().strip()[:n]
print('Yes' if is_available(picture) else 'No')

n = int(input())
s = input()
if s == '?' * n:
    print('YES')
else:
    for i in range(n - 1):
        if s[i] == s[i + 1] != '?':
            print('NO')
            break
    else:
        flag = False
        a = 0
        for i in range(n):
            if s[i] == '?':
                if i != 0:
                    b = s[i - 1]
                else:
                    b = 'gg'
                a += 1
            else:
                c = s[i]
                if a != 0:
                    if b == 'gg' or b == c or b != c and a % 2 == 0:
                        print('YES')
                        break
                a = 0
        else:
            c = s[i]
            if a != 0:
                if b == c or b != c and a % 2 == 0:
                    print('YES')
                else:
                    print('NO')
            else:
                print('NO')

n=int(input())
Ar=input()
if Ar.find("MM")!=-1:
    print("NO")
elif Ar.find("YY")!=-1:
    print("NO")
elif Ar.find("CC")!=-1:
    print("NO")
elif Ar[0]=='?' or Ar[-1]=='?':
    print("YES")
elif Ar.find("???")!=-1:
    print("YES")
else:
    C=Ar.count('?')
    cnt=0
    for i in range(1,n-1):
        if Ar[i]=='?' and (Ar[i-1]=='C' and Ar[i+1]=='C') or (Ar[i-1]=='Y' and Ar[i+1]=='Y') or (Ar[i-1]=='M' and Ar[i+1]=='M'):
            cnt+=1
            break
    l=Ar.find("??")
    while(l!=-1):
        if Ar[l-1]==Ar[l+2]:
            cnt+=2
        l=Ar.find("??",l+2)
    if cnt>0:
        print("YES")
    else:
        print("NO")

# cook your dish here
from sys import stdin,stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I=lambda: map(int,stdin.readline().split())
I1=lambda: stdin.readline()

n=int(I1())
s=I1().strip()
i,f=0,0
for j in range(1,n):
    if s[j]==s[j-1] and s[i]!='?':
        print('No')
        exit()
while i<n:
    if s[0]=='?' or s[n-1]=='?':
        f=1
        break
    elif s[i]=='?':
        j=i+1
        while s[j]=='?':j+=1
        if(s[i-1]==s[j]):
            f=1
            break
    i+=1
if f==1: print("Yes")
else : print("No")

n = int(input())
s = input()
flag=0
for i in range(n):
    if i==0:
        if s[0] == '?':
            flag=1
            break
    elif i==n-1:
        if s[n-1] == '?':
            flag=1
            break
    else:
        if s[i] == '?':
            if s[i-1] == s[i+1]:
                flag=1
                break
for i in range(n-1):
    if s[i] == s[i+1] and s[i] != '?':
        flag=0
if flag==0:
    print('No')
else:
    print('Yes')

n = int(input())

mural = input()

questions = mural.count('?')

if questions < 2:
    print("No")

elif questions > 2:
    print("Yes")

else:
    idx = mural.find('??')
    if idx == -1:
        print("Yes")

    else:
        if idx == 0 or idx == n-2 or mural[idx-1] == mural[idx+2]:
            print("Yes")
        else:
            print("No")

def main():
    n=input()
    l=map(str," ".join(raw_input()).split())
    for i in xrange(1,n):
        if l[i]==l[i-1] and l[i]!='?':
            print "No"
            exit()
    for i in xrange(2,n):
        if l[i-1]=='?' and l[i]!=l[i-2]:
            print "No"
            exit()

    print "Yes"

main()

n1 = input()
n = int(n1)
s = []
flag = False
sc = input()
for i in range(n):
    s.append(sc[i])
    if i > 0:
        if s[i] == s[i-1] and s[i] != '?':
            flag = False
            break

if flag == False:
    print('NO')
    exit()
for i in range(n):
    if s[i] == '?':
        if i == 0 or i == n-1:
            flag = True
            break
        elif s[i-1] == s[i+1]:
            flag = True
            break
if flag:
    print('YES')
else:
    print('NO')

import sys
n=int(input())
s=raw_input()
for i in xrange(len(s)-1):
    if s[i+1]==s[i] and s[i]!="?":
        print"No"
        sys.exit()
l=[]
for i in xrange(len(s)):
    if s[i]=="?":
        l.append(i)
for i in l:
    if i!=0 and i!=n-1:
        if s[i+1]!=s[i-1] and s[i+1]!="?" and s[i-1]!="?":
            if len(l)==1:
                print"No"
                sys.exit()
print"Yes"

n = int(input())
s = input()

# Case where we can't use two coloring :
# 1) no "?" present
# 2) X?Y Case
# 3) X??X S'il existe des suites

ans = "Yes"
no_int = s.count("?")

def is_cool(s):
    if s.count("??"):
        return True
    else:
        a = s.count("C?C") + s.count("M?M") + s.count("Y?Y")
        return a > 0

ok = (s.count("MM") + s.count("CC") + s.count("YY")) == 0
# print("ok : ", ok)

if n == 1:
    if s == "?":
        ans = "Yes"
    else:
        ans = "No"
else:

    if not (ok):
        ans = "No"
    elif no_int == 0:
        ans = "Yes"
    elif s[0] == "?" or s[-1] == "?":
        ans = "Yes"
    elif s.count("M?C") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("M?Y") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("C?M") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("C?Y") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("Y?C") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"
    elif s.count("Y?M") >= 1:
        if is_cool(s):
            ans = "Yes"
        else:
            ans = "No"

print(ans)

def main():
    n=input()
    l=map(str," ".join(raw_input()).split())
    for i in xrange(1,n):
        if l[i]==l[i-1] and l[i]!='?':
            print "No"
            exit()
    if l.count('?')==1:
        for i in xrange(2,n):
            if l[i-1]=='?' and l[i]!=l[i-2] and (l[i]!='?' and l[i-2]!='?'):
                print "No"
                exit()

    print "Yes"

main()

x=int(input())
string=input()
i=0
counter=0
right=-1
left=0
if string.count('MM')>=1 or string.count('CC')>=1 or string.count('YY')>=1:
    print("NO")
else:
    while i<x:
        right=string[i+1]
        if i==0 and string[i]!='?':
            left=string[i]
            i+=1
            continue
        elif i==x-1:
            if string[-1]=='?':
                counter+=2
            break
        if string[i]=='?':
            if left==right:
                counter+=1
            else:
                counter+=2
                break
            if string[i+1]=='?':
                pass
            else:
                left=string[i+1]
        else:
            left=string[i]
        i+=1
    if counter>=2:
        print("YES")
    else:
        print("NO")

n=int(input())
s=str(input())
flag=0
for i in range(0,len(s)-1):
    if(s[i]==s[i+1] and s[i]!='?'):
        flag=1
if(flag==1):
    print('')
elif(flag==0):
    if(s[0]=='?' or s[-1]=='?'):
        print('YES')
    else:
        flags=0
        for j in range(0,len(s)):
            if(s[j]=='?'):
                d=set()
                if(s[j+1]!='?'):
                    d.add(s[j+1])
                if(s[j-1]!='?'):
                    d.add(s[j-1])
                if(len(d)==1):
                    print('YES')
                    flags=1
                    break
        if(flags==0):
            print('NO')

'''input
5
C??MM
'''
from collections import defaultdict as df
from bisect import bisect_left as bl
import sys

n=input()
s=raw_input().strip()
ans="Yes"
for i in range(1,n-2):
    if s[i]=="?"and s[i+1]=="?":
        if s[i-1]!="?" and s[i+2]!="?" and s[i-1]!=s[i+2]:
            ans="No"

print ans

from __future__ import division
from sys import stdin, stdout
# from fractions import gcd
# from math import *
# from operator import mul
# from functools import reduce
# from copy import copy
from collections import deque, defaultdict, Counter

rstr = lambda: stdin.readline().strip()
rstrs = lambda: [str(x) for x in stdin.readline().split()]
rint = lambda: int(stdin.readline())
rints = lambda: [int(x) for x in stdin.readline().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = lambda n: [rints() for _ in range(n)]
pr = lambda args, sep: stdout.write(sep.join(map(str, args)) + '\n')
out = []

n, s, cur, ans = int(input()), rstr(), 0, 'YES'
if '?' in s:
    valid = 0
    for i in range(n):
        if s[i] == '?':
            cur += 1
        else:
            if i and s[i] == s[i - 1] and not cur:
                valid = 0
                break

            if cur > 1 or i == cur or s[i] == s[i - 2]:
                valid += 1

            cur = 0

    print('YES' if valid or cur else 'NO')
else:
    for i in range(1, n):
        if s[i] == s[i - 1]:
            print('NO')
            exit()

    print('YES')

from __future__ import division
from sys import stdin, stdout
# from fractions import gcd
# from math import *
# from operator import mul
# from functools import reduce
# from copy import copy
from collections import deque, defaultdict, Counter

rstr = lambda: stdin.readline().strip()
rstrs = lambda: [str(x) for x in stdin.readline().split()]
rint = lambda: int(stdin.readline())
rints = lambda: [int(x) for x in stdin.readline().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = lambda n: [rints() for _ in range(n)]
pr = lambda args, sep: stdout.write(sep.join(map(str, args)) + '\n')
out = []

n, s, cur, ans = int(input()), rstr(), 0, 'YES'
for i in range(n):
    if s[i] == '?':
        cur += 1
    else:
        if cur == 1 and s[i] != s[i - 2]:
            ans = 'NO'
            break
        cur = 0

print(ans)

n=int(input())
s=raw_input()

def solve(s):
    if "?" not in s:
        for i in range(1,n-1):
            if s[i]==s[i-1] or s[i]==s[i+1]:
                return "No"
        return "Yes"

    else:
        for i in range(1,n-1):
            if (s[i]==s[i-1] or s[i]==s[i+1]) and s[i]!="?":
                return "No"

        for i in range(1,n-1):
            if s[i]=="?" and s[i+1]=="?":
                if s[i-1]!="?":
                    if i+2<=n-1:
                        if s[i+2]!="?":
                            if s[i-1]!=s[i+2]:
                                return "No"

        count=0
        for i in range(1,n-1):
            if s[i]=="?":
                if s[i-1]!="?" and s[i+1]!="?" and s[i-1]!=s[i+1]:
                    count+=1
        if count==s.count("?"):
            return "No"
        return "Yes"
print(solve(s))

i=input;i();z=i()
print('Yes'if('??'in z or'Y?Y'in z or'Z?Z'in z or'M?M'in z)and not('CC'in z or'MM'in z or'YY'in z)else'No')

n = int(input())
s = input()
for i in range(1, n):
	if s[i] == s[i - 1] and s[i] != '?':
		print("no")
		quit()
	if s[i] == '?':
		if i != n - 1 and s[i - 1] != s[i + 1] and s[i - 1] != '?' and s[i + 1] != '?':
			print("no")
			quit()
print("yes")

def main():
    n=input()
    l=map(str," ".join(raw_input()).split())
    for i in xrange(1,n):
        if l[i]==l[i-1] and l[i]!='?':
            print "No"
            exit()
    for i in xrange(4,n):
        if l[i-1]=='?' and l[i-3]==l[i-1] and l[i-4]==l[i] and l[i-2]!=l[i] and l[i]!='?' and l[i-2]!='?':
            print "No"
            exit()

    print "Yes"

main()

from sys import stdin

lines = stdin.readlines()
n = int(lines[0])
s = lines[1].split()[0]
a = True
b = True
summ = 0
if "?" not in s:
    print "No"
    a = False
    b = False
if b:
    for i in range(n-1):

        if s[i] == s[i+1] and s[i] != "?":
            print "No"
            a = False
            break
        elif s[i] == "?" and i>0 and (s[i-1] != s[i+1]):
            summ += 1
        elif s[i] == "?":
            summ += 1
if s[-1] == "?":
    summ += 1
if a == True and summ > 1:
    print "Yes"
elif summ == 1:
    print "No"

n = int(input())
a = list(input())
t=0
g =a.count("?")
if g==0:
	print("No")
	exit()

for i in range(n-1):
	j = i+1
	if (a[i]==a[j] and a[i]!="?") :
		print("No")
		exit()
for i in range(1,n-2):
	if a[i-1]!=a[i+1] and a[i]=="?" and (a[i-1]!="?" and a[i+1]!="?" ):
		t+=1

if t<g and t!=0:
	print("no")
	exit()
print("Yes")

from functools import reduce
N=int(input())
colors  = input()
def compare(x, y):
    if  x==False  or x == y and  ( x=="C" or x=="M" or x=="Y"):
            return False
    return y

def check_for_doublees(colors):
    if colors[0]=="?" or colors[-1]=="?":
        return True
    for i in range(1, len(colors)-1):
        if colors[i] == "?" and colors[i-1] != colors[i+1]:
            return True

    return  True

def logic(colors):
    print("Yes") if reduce(compare, colors) and check_for_doublees(colors) else print("No")

logic(colors)

from sys import stdin

lines = stdin.readlines()
n = int(lines[0])
s = lines[1].split()[0]
a = True
summ = 0
for i in range(n-1):
    if summ > 1:
        print "No"
        a = False
        break
    elif s[i] == s[i+1] and s[i] != "?":
        print "No"
        a = False
        break
    elif s[i] == "?" and i>0 and (s[i-1] != s[i+1]):
        summ += 1
    elif s[i] == "?":
        summ += 1

if a == True:
    print "Yes"

def f(s,n):
    if s[0] == '?' or s[-1] == '?':
        return ('Yes')
    for i in range(1,n-1):
        if s[i] == '?':
            if s[i-1] == s[i+1] or s[i-1] == '?' or s[i+1] == '?':
                return 'Yes'
    return 'No'

n = int(input())
s = input()
print(f(s,n))

n=int(input())
s=input()
f=1
for i in range(n-1):
    if s[i]==s[i+1] and s[i]!='?' and s[i+1]!='?':
        f=0
        break
if f==0:
    print('No')
else:
    ms=set()
    if '??' in s:
        print('Yes')
    elif '?' not in s:
        print('Yes')
    else:
        f=0
        for i in range(1,n-1):
            if s[i]=='?':
                a,b=s[i-1],s[i+1]
                if a==b:
                    f=1
        if n<=2:
            print('Yes')
        elif '?' not in s[1:n-1]:
            print('Yes')
        elif f==0:
            print('No')

        else:
            print('Yes')

n=int(input())
s=input()
for i in range(n-1):
    if s[i]==s[i+1]:
        print("NO")
        quit()
print("YES")

n=int(input())
Ar=input()
if Ar[0]=='?' or Ar[-1]=='?':
    print("YES")
elif Ar.find("???")!=-1:
    print("YES")
else:
    C=Ar.count('?')
    cnt=0
    for i in range(1,n-1):
        if Ar[i]=='?' and (Ar[i-1]=='C' and Ar[i+1]=='C') or (Ar[i-1]=='Y' and Ar[i+1]=='Y') or (Ar[i-1]=='M' and Ar[i+1]=='M'):
            cnt+=1
            break
    l=Ar.find("??")
    while(l!=-1):
        if Ar[l-1]==Ar[l+2]:
            cnt+=2
        l=Ar.find("??",l+2)
    if cnt>0:
        print("YES")
    else:
        print("NO")

from functools import reduce
N=int(input())
colors  = input()
def compare(x, y):
    if  x==False  or x == y and  ( x=="C" or x=="M" or x=="Y"):
            return False
    return y

def check_for_doublees(colors):
    if colors[0]=="?" or colors[-1]=="?":
        return True
    for i in range(1, len(colors)-1):
        if colors[i] == "?" and colors[i-1] != colors[i+1]:
            return False

    return  True

def logic(colors):
    print("Yes") if reduce(compare, colors) and check_for_doublees(colors) else print("No")

logic(colors)

#Abhigyan Khaund - syl
# t = int(raw_input())
# while t:
# 	t-=1
# 	m = map(int, raw_input().split())

n = int(raw_input())
v = raw_input()
yes = 1
for i in range(1,n):
	if(v[i]==v[i-1] and v[i]!='?'):
		yes = 0
		break
if(yes):
	print "Yes"
else:
	print "No"

from sys import stdin

lines = stdin.readlines()
n = int(lines[0])
s = lines[1].split()[0]
a = True
summ = 0
if "?" not in s:
    print "No"
    a = False

for i in range(n-1):
    if summ > 1:
        print "No"
        a = False
        break
    elif s[i] == s[i+1] and s[i] != "?":
        print "No"
        a = False
        break
    elif s[i] == "?" and i>0 and (s[i-1] != s[i+1]):
        summ += 1
    elif s[i] == "?":
        summ += 1

if a == True:
    print "Yes"

n = int(input())
s = input()
flag = False
if s == '?':
    print('YES')
else:
    for i in range(n - 1):
        if s[i] == s[i + 1] != '?':
            print('NO')
            break
        if s[i] == '?':
            flag = True
    else:
        if not flag:
            print('NO')
        else:
            print('YES')

t = int(input())
str = list(input())
lstr = len(str)
sw2 = 0

if lstr == 1:
    print("Yes")
    exit()
if lstr == 2 and str[0] != str[1]:
    print("Yes")
    exit()

for i in range(lstr):
    if str[i] != '?':
        if i != 0 and i != lstr - 1:
            if str[i] == str[i-1] or str[i] == str[i+1]:
                print("No")
                exit()
        elif i == 0 and lstr != 1:
            if str[i] == str[i+1]:
                print("No")
                exit()
        else:
            if str[i] == str[i-1]:
                print("No")
                exit()

    else:
        if i != 0 and i != lstr - 1:
            if str[i-1] != str[i+1]:
                sw2 = 1
        else:
            sw2 = 1

if sw2:
    print("Yes")
else:
    print("No")

n = int(input())
s = input()
if s.count('MM') > 0 or s.count('CC') > 0 or s.count('YY') > 0:
    print('No')
else:
    if s.count('??') > 0 or s[0] == '?' or s[-1] == '?':
        print('Yes')
    else:
        for i in range(1, n - 1):
            if s[i] == '?':
                if s[i - 1] == s[i + 1]:
                    print('Yes')
                    exit()
            if i == n - 2:
                print('No')

n=int(input())
s=input()
f=1
for i in range(n-1):
    if s[i]==s[i+1] and s[i]!='?' and s[i+1]!='?':
        f=0
        break
if f==0:
    print('No')
else:
    ms=set()
    if '??' in s:
        print('Yes')
    elif '?' not in s:
        print('Yes')
    else:
        if s[0]=='?' or s[-1]=='?':
            print('Yes')
        if 'C?C' in s:
            print('Yes')
        elif 'M?M' in s:
            print('Yes')
        elif 'Y?Y' in s:
            print('Yes')
        else:
            print('No')

n=int(input())
s=input()
f=1
for i in range(n-1):
    if s[i]==s[i+1] and s[i]!='?' and s[i+1]=='?' and s[i]!='?':
        f=0
        break
if f==0:
    print('No')
else:
    ms=set()
    if '??' in s:
        print('Yes')
    if '?' not in s:
        print('Yes')
    else:
        f=0
        for i in range(1,n-1):
            if s[i]=='?':
                a,b=s[i-1],s[i+1]
                if a==b:
                    f=1
        if f==0:
            print('No')

        else:

            print('Yes')

n=int(input())
ch=input()
if ch.count('?')==0:
    print('NO')
else:
    if 'CC' in ch:
        print('NO')
    elif 'MM' in ch:
        print('NO')
    elif 'YY' in ch:
        print('NO')
    elif ('C?Y?' in ch) and ('C?Y?Y' not in ch):
        print('NO')
    elif ('C?M?' in ch) and ('C?M?M' not in ch):
        print('NO')
    elif ('M?C?' in ch) and ('M?C?C' not in ch):
        print('NO')
    elif ('M?Y?' in ch) and ('M?Y?Y' not in ch):
        print('NO')
    elif ('Y?C?' in ch) and ('Y?C?C' not in ch):
        print('NO')
    elif ('Y?M?' in ch) and ('Y?M?M' not in ch):
        print('NO')
    else:
        print('YES')

t = int(input())
str = list(input())
lstr = len(str)

if '?' not in str:
    print("No")
    exit()

sw2 = 0
if lstr == 1:
    print("Yes")
    exit()
if lstr == 2 and str[0] != str[1]:
    print("Yes")
    exit()
if lstr == 3 and str[1] == '?' and str[0] != str[2]:
    print("No")
    exit()
if lstr == 3 and (str[0] != str[1] and str[1] != str[2]):
    print("Yes")
    exit()

for i in range(lstr):
    if str[i] != '?':
        if i != 0 and i != lstr - 1:
            if str[i] == str[i-1] or str[i] == str[i+1]:
                print("No")
                exit()
        elif i == 0 and lstr != 1:
            if str[i] == str[i+1]:
                print("No")
                exit()
        else:
            if str[i] == str[i-1]:
                print("No")
                exit()

    else:
        if i != 0 and i != lstr - 1:
            if str[i-1] != str[i+1]:
                sw2 = 0
        else:
            sw2 = 1

if sw2:
    print("Yes")
else:
    print("No")

n = int(input())
a = list(input())

for i in range(n-1):
	j = i+1
	if (a[i]==a[j] and a[i]!="?") :
		print("No")
		exit()
for i in range(1,n-2):
	if a[i-1]!=a[i+1] and a[i]=="?":
		print("No")
		exit()

print("Yes")

def checker(paints):

    i=1
    while i < len(paints) - 1:
        if paints[i] == '?' and paints[i - 1] != '?' and paints[i + 1] != '?' and paints[i - 1] != paints[i + 1]:
            paints = paints.replace(paints[i], '', 1)
        i += 1

    for i in range(0, len(paints) - 1, 1):
        if paints[i] == paints[i + 1] and paints[i] != '?' and paints[i + 1] != '?':
            return False

    return paints.__contains__('?')

lengthOfTheCanvas = int(input())
paints = input()
if checker(paints):
    print("Yes")
else:
    print("No")

import math
import queue

from itertools import permutations

n=int(input())
s=input()

def determine(t):
    for i in range(0,n-1):
        if t[i]==t[i+1] and t[i]!='?':
            return False

    for i in range(0,n-1):
        if t[i]=='?' and t[i+1]=='?':
            return True

    num=0

    if t[0]=='?' or t[n-1]=='?':
        return True

    for i in range(1,n-1):
        if t[i]=='?' and t[i-1]!=t[i+1]:
            return True
    return False

if determine(s):
    print("YES")
else:
    print("No")

N=int(input()) #take the size

Array=list(map(str,input().split()[:N]))

s=''.join(Array)

C = s.find('CC')
cc = s.find('cc')
cC = s.find('cC')
Cc = s.find('Cc')

M = s.find('MM')
mm = s.find('mm')
Mm = s.find('Mm')
mM = s.find('mM')

Y = s.find('YY')
yy = s.find('yy')
Yy = s.find('Yy')
yY = s.find('yY')

if (Y<1 and M<1 and C<1 and mm<1 and cc<1 and yy<1 and cC<1 and mM<1 and yY<1 and Cc<1 and Mm<1 and Yy<1):
    print("Yes")
else:
    print("No")

n = int(input())
a = input()

flag = 0
for ind, a_i in enumerate(a):
    if ind == 0:
        continue
    else:
        if a_i == a[ind - 1] and a_i != '?':
            flag = 1
            break

if flag == 1:
    print('No')
else:
    if a.count('?') >= 2:
        flag = 0
        for ind, a_i in enumerate(a):
            if ind != 0:
                if a_i == '?' and a[ind - 1] == a[ind + 1]:
                    flag = 1
                    break
            elif ind == 0 and a_i == '?':
                flag = 1
                break
        print('Yes' if flag == 1 else 'No')
    else:
        ind = a.index('?')
        if ind == 0 or ind == n - 1:
            print('Yes')
        else:
            if a[ind - 1] == a[ind + 1]:
                print('Yes')
            else:
                print('No')

n = input()
txt = str(raw_input())
licz = 0
licz_y = 0
if n == 1:
    if txt[0] == '?':
        print 'Yes'
        exit(0)
    else:
        print 'No'
        exit(0)
if n == 2 and (txt[0] == '?' or txt[1] == '?'):
    print 'Yes'
    exit(0)
for x in range(0, len(txt)-1, +1):
    if (txt[x] == txt[x+1]) and txt[x] != '?':
        print 'No'
        exit(0)
    if txt[x] == '?' and x != 0:
        if (txt[x-1] != txt[x+1]) and txt[x-1] != '?' and txt[x+1] != '?':
            licz +=1
    if txt[x]=='?':
        licz_y += 1
if licz == licz_y and licz != 0:
    print 'No'
    exit(0)
print 'Yes'

n = int(input())
a = input()
a = list(a)

t=0

g =a.count("?")

if g==0:
	print("No")
	exit()

for i in range(n-1):
	j = i+1
	if (a[i]==a[j] and a[i]!="?") :
		print("No")
		exit()
for i in range(1,n-2):
	if a[i-1]!=a[i+1] and a[i]=="?" and (a[i-1]!="?" and a[i+1]!="?" ):
		t+=1

if t>=g and t!=0:
	print("no")
	exit()
print("Yes")

import math
from decimal import Decimal
def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return n,b

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return n,b,c

def dv():
	n, m = map(int, input().split())
	return n,m

def dva():
	n, m = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return n,m,b

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return n,b,m,c

def dvs():
	n = int(input())
	m = int(input())
	return n, m

n = int(input())
s = input()
k = 0
tk = 0
for i in range(n - 1):
	if s[i] == '?':
		k += 1
	if s[i] == '?' and i > 0 and s[i - 1] != s[i + 1] and s[i-1] != '?' and s[i+1] != '?':
		tk += 1
	if s[i] == s[i + 1] and s[i] != '?':
		print('NO')
		exit()
if k == tk:
	print('NO')
else:
	print('YES')

n=int(input())
color = input()
c=False
q=color.count("?")

print(q)

if q<2:
	print("No")
for i in range(n):
	j=i+1
	if color[i]==color[j]:
		C = True
		break
if q<2 or C:
	print("No")
else:
	print("Yes")

n=int(input())
s=input()
if (s[0]=='?') or (s[-1]=='?'):
    print('Yes')
else:
    if ('MM' in s) or ('CC' in s) or ('YY' in s):
        print('No')
    else:
        if '??' in s:
            print('Yes')
        else:
            if ('C?C' in s) or ('M?M' in s) or ('Y?Y' in s):
                print('Yes')
            else:
                print('No')

n = int(input())
s = input()

# Case where we can't use two coloring :
# 1) no "?" present
# 2) X?Y Case
# 3) X??X S'il existe des suites

ans = "Yes"
no_int = s.count("?")

def is_cool(s):
    if s.count("??"):
        return True
    else:
        a = s.count("C?C") + s.count("M?M") + s.count("Y?Y")
        return a > 0

ok = (s.count("MM") + s.count("CC") + s.count("YY")) == 0
# print("ok : ", ok)

if not(ok):
    ans = "No"
elif no_int == 0:
    ans = "Yes"
elif s[0] == "?" or s[-1] == "?":
    ans = "Yes"
elif s.count("M?C") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("M?Y") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("C?M") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("C?Y") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("Y?C") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("Y?M") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"

print(ans)

n = int(input())
colors = [i for i in input()]
maners = [0 for i in range(n)]
i = 0
maners[i] = 1 if(colors[i]!="?") else 3
i+=1
while i < n:
    if(colors[i-1]==colors[i]) and colors[i]!="?":
        x = 0
    elif(colors[i-1]==colors[i]):
        x = maners[i-1] - 1
    else:
        x = 3
    maners[i] = x
    i+=1
s = 1
for i in maners:
    s*=i
if(s>2):
    print("Yes")
else:
    print("No")

n = int(input())
s = 'T' + input() + 'T'
res = 'Yes'
flex = False
for i in range(1, n+1):
    if not flex and s[i] == '?':
        if s[i-1] == '?' or s[i+1] == '?':
            flex = True
        elif s[i-1] != s[i+1]:
            flex = True
    if s[i] != '?' and s[i] == s[i-1]:
        res = 'No'
        break
if res == 'YES' and not flex:
    res = 'NO'
print(res)

import sys

def input(): return sys.stdin.readline().rstrip("\r\n")
def List(): return list(map(int, input().split()))
def Num(): return int(input())

n = Num()
s = input()
is_cons = False
for i in range(1, n):
    if s[i] != "?" and s[i] == s[i - 1]:
        is_cons = True
if is_cons:
    print("NO")
else:
    print("YES")

n = int(input())
s = list(input())

def main():
    if '?' not in s:
        print('No')
        return

    if n == 1:
        print('Yes')
        return

    if s[0]=='?' or s[n-1]=='?':
        print('Yes')
        return

    for i in range(1,n):
        j = i-1
        if s[i] == s[j] and s[i] != '?':
            print('No')
            return

    for i in range(1,n):
        j = i-1
        if s[i] == s[j]:
            print('Yes')
            return

    for i in range(2,n):
        i_1 = i-1
        i_2 = i-2
        if (s[i_2] == s[i]) and  s[i_1]=='?':
            print('Yes')
            return

    print('No')
    return

main()

n = int(input())
lst = list(input())
s=0
z=0
#print(len(lst))
lst1 = ["C", "Y", "M"]
n=0
for i in range(len(lst)-1):
    if lst[i]=="?":
        n+=1
for i in range(len(lst)-1):
    if lst[i]=='?':
        s+=1
        if i==0:
            s+=1
        elif i==len(lst)-1:
            s+=1
        elif i>0 and i<len(lst)-1:
            if lst[i-1]==lst[i+1]:
                s+=1
            else:
                z+=2
                s+=1
    if lst[i]==lst[i+1]:
        z=1
#print(z,s)
if s!=0:
    if z%s==0 and z!=0:
        print('No')
elif n==len(lst)-1:
    print("Yes")
elif z==1:
    print("No")
elif s==0:
    print("Yes")
else:
    print("Yes")

n=int(input())
s=list(input())
if s.count("?")==0:
    print("No")
    exit(0)

f=0
a=s[0]
for i in range(1,n):
    if s[i]==s[i-1] and s[i]!="?":
        f=1
s=["*"]+s+["&"]
g=0
if s.count("?")==1:
    for i in range(1,n+1):
        if s[i]=="?" and s[i-1]==s[i+1] :
            g+=1
if f==1 or g>0:
    print("No")
else:
    print("Yes")

n = int(input())
s = input()
for i in range(n - 1):
    if s[i] == s[i + 1] != '?':
        print('NO')
        break
else:
    flag = False
    a = 0
    for i in range(n):
        if s[i] == '?':
            if i != 0:
                b = s[i - 1]
            else:
                b = 'gg'
            a += 1
        else:
            c = s[i]
            if a != 0:
                if b == 'gg' or b == c or b != c and a % 2 == 0:
                    print('YES')
                    break
    else:
        print('NO')

n = int(input())
s = input()
if s == '?' * n:
    print('YES')
else:
    for i in range(n - 1):
        if s[i] == s[i + 1] != '?':
            print('NO')
            break
    else:
        flag = False
        a = 0
        for i in range(n):
            if s[i] == '?':
                if i != 0:
                    b = s[i - 1]
                else:
                    b = 'gg'
                a += 1
            else:
                c = s[i]
                if a != 0:
                    if b == 'gg' or b == c or b != c and a % 2 == 0:
                        print('YES')
                        break
                a = 0
        else:
            c = s[i]
            if a != 0:
                if b == c or b != c and a % 2 == 0:
                    print('YES')
                else:
                    print('NO')

n=int(input())
s=input()
for i in range(n-1):
    if s[i]==s[i+1]:
        print("NO")
        quit()
print("YES")

n=int(input())
s=input()
cont=0
x=s[0]
t=False
t1=True
if x=='?':
    t=True
for i in range(1,n):
    if s[i]==s[i-1] and s[i]!='?':
        t1=False
        break
    if (s[i]=='?' and i+1!=n and s[i-1]==s[i+1]) or (s[i-1]=='?' )or (s[i]=='?' and i+1==n) :
        t=True
if t== True and t1==True:
    print("Yes")
else:
    print("No")

n = int(input())
s = input()
ans = 0
for i in range(n):
    if (i<n-1 and s[i]==s[i+1]=='?'):
        ans = 1
    if (s[i]=='?' and (i==0 or i==n-1 or s[i-1]==s[i+1])):
        ans = 1
for i in range(n-1):
    if (s[i]==s[i+1]):
        ans = 0
if (ans==1):
        print("Yes")
else:
    print("No")

n=input()
st=str(raw_input())
c=0
ans=0
for i in range(0,len(st)):
  if st[i]=="?":
    c=c+1
    vl=i
  elif i<len(st)-1 and st[i]==st[i+1]:
    ans=-1
if ans==-1:
  print "no"
else:
  if c>=2:
    ans=1
  if c==1:
    if vl==0 or vl==n-1:
      ans=1
    elif st[vl-1]==st[vl+1]:
      ans=1
  if ans==1:
    print "yes"
  else:
    print "no"

n = int(input())
s = input()
flag=0
for i in range(n):
    if i==0:
        if s[0] == '?':
            flag=1
            break
    elif i==n-1:
        if s[n-1] == '?':
            flag=1
            break
    else:
        if s[i-1]=='?' or s[i+1]=='?':
            flag=1
            break
        elif s[i-1] == s[i+1]:
            flag=1
            break
for i in range(n-1):
    if s[i] == s[i+1] and s[i] != '?':
        flag=0
if flag==0:
    print('No')
else:
    print('Yes')

n=int(input())
color = input()
c=False
q=color.count("?")

for i in range(n):
	j=i+1
	if color[i]==color[j]:
		C = True
		break
if q<2 or C:
	print("No")
else:
	print("Yes")

a=int(input());b=input()+'@';ans=1;i=0
while i<a:
    if b[i]!='?' and b[i+1]!='?' and b[i]==b[i+1]:ans=0
    i+=1
if ans:print("YES")
else:print("NO")

n = input()
txt = str(raw_input())
licz = 0
licz_y = 0
if n == 1 and txt[0] == '?':
    print 'Yes'
    exit(0)
if n == 2 and (txt[0] == '?' or txt[1] == '?'):
    print 'Yes'
    exit(0)
for x in range(0, len(txt)-1, +1):
    if (txt[x] == txt[x+1]) and txt[x] != '?':
        print 'No'
        exit(0)
    if txt[x] == '?' and x != 0:
        if (txt[x-1] != txt[x+1]) and txt[x-1] != '?' and txt[x+1] != '?':
            licz +=1
    if txt[x]=='?':
        licz_y += 1
if licz == licz_y:
    print 'No'
    exit(0)
print 'Yes'

n = int(input())
a = input()
f = 0
for i in range(len(a)):
    if a[i] == '?':
        f = 1
        break
if f == 0:
    print('No')
    exit()
for i in range(1, len(a)):
    if a[i] != '?' and a[i] == a[i-1]:
        print('No')
        exit()
s = 0
for i in range(1,len(a)-1):
    if a[i] =='?':
        s += 1
if s == 1:
    for i in range(1, len(a) - 1):
        if a[i] == '?' and a[i-1] != a[i+1]:
            print('No')
            exit()

print('Yes')

n=int(input())
Ar=input()
if Ar[0]=='?' or Ar[-1]=='?':
    print("YES")
elif Ar.find("???")!=-1:
    print("YES")
else:
    C=Ar.count('?')
    cnt=0
    for i in range(1,n-1):
        if Ar[i]=='?' and (Ar[i-1]=='C' and Ar[i+1]=='C') or (Ar[i-1]=='Y' and Ar[i+1]=='Y') or (Ar[i-1]=='M' and Ar[i+1]=='M'):
            cnt+=1
            break
    l=Ar.find("??")
    while(l!=-1):
        if Ar[l-1]==Ar[l+2]:
            cnt+=2
        l=Ar.find("??",l+2)
    if cnt>0:
        print("YES")
    else:
        print("NO")

n = int(input())
s = input()

def f(s):
    for i in range(len(s)):
        if s[i] == '?':
            if i == 0 or i == len(s) - 1:
                return True
            else:
                if s[i + 1] == '?':
                    if i + 2 < len(s):
                        if s[i - 1] == s[i + 2]:
                            return True
                if s[i - 1] == s[i + 1]:
                    return True
    return False

if f(s):
    print("Yes")
else:
    print("No")

n = int(input())
s = input()
for i in range(1, n):
	if s[i] == s[i - 1] and s[i] != '?':
		print("no")
		quit()
	if s[i] == '?':
		if i != n - 1 and s[i - 1] != s[i + 1] and (s[i - 1] != '?' or s[i + 1] != '?'):
			print("no")
			quit()
print("yes")

n = int(input())

mural = input()

result = 'Yes'
flag = True
if mural.count('?') == 0:
    print('No')

else:
    if n == 1 or n == 2:
        print('Yes')

    else:
        if mural[0] == '?' or mural[-1] == '?':
            print('Yes')
        else:
            for i in range(1, n-1):
                if mural[i] == mural[i-1] or mural[i] == mural[i+1]:
                    if mural[i] != '?':
                        result = 'No'
                        break
                    else:
                        result = 'Yes'
                        flag = False

                elif mural[i] == '?' and flag:
                    if mural[i-1] != mural[i+1]:
                        result = 'No'
                    else:
                        result = 'Yes'
                        flag = False

            print(result)

#Abhigyan Khaund - syl
# t = int(raw_input())
# while t:
# 	t-=1
# 	m = map(int, raw_input().split())

n = int(raw_input())
v = raw_input()
yes = 1
for i in range(1,n):
	if(v[i]==v[i-1] and v[i]!='?'):
		yes = 0
		break
if(yes):
	print "Yes"
else:
	print "No"

# -*- coding: utf-8 -*-
"""
Created on Thu Mar 29 10:47:16 2018

@author: Administrator
"""

n = int(input())
s = input()
cnt = 0
flag = False
index = 0
for i in s:
    if i == '?':
        cnt = cnt + 1
    else:
        if cnt >= 3:
            flag = True
            break
        elif cnt <= 2 and cnt > 0:
            if index - cnt - 1< 0:
                flag = True
                break
            elif s[index] == s[index-cnt-1]:
                flag = True
                break
        cnt = 0
    index = index + 1
if cnt > 0:
    flag = True
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        flag = False
if flag:
    print("Yes\n")
else:
    print("No\n")

def dfs(s,x,y,n):
    c = ['C', 'Y', 'W']
    sum = 0
    if x == 0:
        if x == n-1:
            return 3
        else:
            for i in range(3):
                if x == y-1:
                    if c[i] != s[y]:
                        sum += 1
                else:
                     sum += dfs(s,x+1,y,n)
    else:
        if x == n-1:
            for i in range(3):
                if c[i] != s[x-1]:
                    sum += 1
        else:
            for i in range(3):
                if c[i] != s[x-1]:
                    if x == y - 1:
                        if c[i] != s[y]:
                            sum += 1
                    else:
                        s[x] = c[i]
                        sum += dfs(s,x+1,y,n)
    return sum

n1 = input()
n = int(n1)
s = []
flag = True
sc = input()
for i in range(n):
    s.append(sc[i])
    if i > 0:
        if s[i] == s[i-1] and s[i] != '?':
            flag = False
            break

if flag == False:
    print('NO')
    exit()

b = []
j = 0

for i in range(n):
    if s[i] == '?':
        if j == 0:
            x = i
            j += 1
        else:
            j += 1
    elif j != 0:
        b.append(dfs(s,x,x+j,n))
        j = 0
if j != 0:
    b.append(dfs(s,x,x+j,n))
    j = 0

sum = 1
l = len(b)
for i in range(l):
    sum *= b[i]

if sum >= 2:
    print('YES')
else:
    print('NO')

n = int(input())
a = list(input())

for i in range(n-1):
	j = i+1
	if (a[i]==a[j] and a[i]!="?") :
		print("No")
		exit()
for i in range(1,n-2):
	if a[i-1]!=a[i+1] and a[i]=="?" and (a[i-1]!="?" or a[i+1]!="?"):
		print("No")
		exit()

print("Yes")

# -*- coding: utf-8 -*-
"""
Created on Thu Mar 29 10:47:16 2018

@author: Administrator
"""

n = int(input())
s = input()
cnt = 0
flag = False
index = 0
for i in s:
    if i == '?':
        cnt = cnt + 1
    else:
        if cnt >= 3:
            flag = True
            break
        elif cnt <= 2 and cnt > 0:
            if index - cnt - 1< 0:
                flag = True
                break
            elif s[index] == s[index-cnt-1]:
                flag = True
                break
        cnt = 0
    index = index + 1
if flag or cnt > 0:
    print("Yes\n")
else:
    print("No\n")

n = int(input())
s = input()

# Case where we can't use two coloring :
# 1) no "?" present
# 2) X?Y Case
# 3) X??X S'il existe des suites

ans = "Yes"
no_int = s.count("?")

def is_cool(s):
    if s.count("??"):
        return True
    else:
        a = s.count("C?C") + s.count("M?M") + s.count("Y?Y")
        return a > 0

ok = (s.count("MM") + s.count("CC") + s.count("YY")) == 0
# print("ok : ", ok)

if no_int == 0:
    ans = "Yes"
elif not (ok):
    ans = "No"
elif s[0] == "?" or s[-1] == "?":
    ans = "Yes"
elif s.count("M?C") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("M?Y") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("C?M") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("C?Y") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("Y?C") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"
elif s.count("Y?M") >= 1:
    if is_cool(s):
        ans = "Yes"
    else:
        ans = "No"

print(ans)