#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++){ if (s[i] == '?'){ s[i] = '0'; string t = s.substr(i - 2, 3); if (t.find('0') != string::npos and t.find('0') != string::npos){ goto no; } t = s.substr(i - 1, 3); if (t.find('0') != string::npos and t.find('0') != string::npos){ goto no; } t = s.substr(i, 3); if (t.find('0') != string::npos and t.find('0') != string::npos){ goto no; } } no:s[i] = '1'; string t = s.substr(i - 2, 3); if (t.find('0') != string::npos and t.find('0') != string::npos){ cout << "No" << endl; return; } t = s.substr(i - 1, 3); if (t.find('0') != string::npos and t.find('0') != string::npos){ cout << "No" << endl; return; } t = s.substr(i, 3); if (t.find('0') != string::npos and t.find('0') != string::npos){ cout << "No" << endl; return; } } cout << "Yes" << endl; } int main() { int t; cin >> t; while (t--){ solve(); } }