#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; while(T--){ int n; string s; cin >> n >> s; bool ans = false; for(int st = 0; st < 4; st++){ if(s[0] != '?' && (st & 1) != s[0] - '0') continue; if(s[1] != '?' && (st >> 1 & 1) != s[1] - '0') continue; vector> dp(n + 1, array({0, 0, 0, 0})); dp[2][st] = true; for(int i = 2; i < n; i++){ if(s[i] != '?'){ int nv = s[i] - '0'; for(int j = 0; j < 4; j++){ if(!dp[i][j]) continue; int ns = nv * 4 + j; if(ns == 0 || ns == 7) continue; dp[i + 1][ns / 2] = true; } }else{ for(int j = 0; j < 4; j++){ if(!dp[i][j]) continue; if(j != 0) dp[i + 1][j / 2] = true; if(j + 4 != 7) dp[i + 1][j / 2] = true; } } } for(int j = 0; j < 4; j++){ if(!dp[n][j]) continue; int s1 = (st & 1) * 4 + j; int s2 = st * 2 + j / 2; if(s1 != 0 && s1 != 7 && s2 != 0 && s2 != 7){ ans = true; break; } } if(ans) break; } cout << (ans ? "Yes" : "No") << '\n'; } }