for _ in range(int(input())): n = int(input()) s = list(map(str, input())) ans = "Yes" for j in range(n): i = (j - 1) % n k = (j + 1) % n tmp = s[i] + s[j] + s[k] if tmp == "0" * 3 or tmp == "1" * 3: ans = "No" break if s[i] == s[j] != "?": s[k] = str(1-int(s[j])) continue elif s[i-1] == s[i] != "?" and s[j] == "?" and s[k] == s[(k+1)%n] != "?" and s[i] != s[k]: ans = "No" break print(ans)