#include using namespace std; using i64 = long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int t; cin >> t; auto solve = [&]() { int n; cin >> n; string s; cin >> s; s = s + s + s + s; for (int i = 0; i + 3 <= 4 * n; i++) { if (s[i] == '?' && s[i + 1] != '?' && s[i + 1] == s[i + 2]) { s[i] = s[i + 1] ^ 1; } } for (int i = 0; i < n; i++) { if (s[i] != '?' && s[i + 1] == s[i] && s[i + 2] == s[i]) { cout << "No\n"; return; } } cout << "Yes\n"; }; while (t--) { solve(); } return 0; }