#include using namespace std; void solve(){ int n; cin >> n; string s; cin >> s; s = s + s + s; for (int i = n; i < n * 2; i++){ string t = s.substr(i - 2, 5); if (t.find('0') != string::npos and t.find('0') != string::npos){ cout << "No" << endl; return; } if (s[i] == '?'){ if (t.find('0') == string::npos){ s[i] = '1'; }else{ s[i] = '0'; } } } cout << "Yes" << endl; } int main() { int t; cin >> t; while (t--){ solve(); } }