#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define int long long
void test_case(){
	int n; cin>>n;
	string s; cin>>s;
	string req = "2020";
	if(s[n-4] == '2' && s[n-3] == '0' && s[n-2] == '2' && s[n-1] == '0'){
		cout<<"YES"<<endl;
		return ;
	}
	if(s[0] == '2' && s[n-3] == '0' && s[n-2] == '2' && s[n-1] == '0'){
		cout<<"YES"<<endl;
		return ;
	}
	if(s[0] == '2' && s[1] == '0' && s[n-2] == '2' && s[n-1] == '0'){
		cout<<"YES"<<endl;
		return ;
	}
	if(s[0] == '2' && s[1] == '0' && s[2] == '2' && s[n-1] == '0'){
		cout<<"YES"<<endl;
		return ;
	}
	if(s[0] == '2' && s[1] == '0' && s[2] == '2' && s[3] == '0'){
		cout<<"YES"<<endl;
		return ;
	}
	cout<<"NO"<<endl;
	
}
		
 
signed main(){
	IOS;
	int t=1, i=1; 
	cin>>t;
	while(t--){
		//cout<<"Case #"<<i<<": ";
		test_case();
		i++;
	}
}
