#include using namespace std; const string YES="Yes"; const string NO="No"; /* s=文字列 S=s+s[0]+s[1] Sの中に"000","111","00?11","11?00"が含まれていたらNo */ int main(){ int t; cin>>t; while(t--){ int n; cin>>n; string s; cin>>s; s=s+s[0]+s[1%n]+s[2%n]+s[3%n]; if(s.find("000")!=string::npos){ cout<