for _ in range(int(input())): n = int(input()) s = 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 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)