#include<bits/stdc++.h>
#define ll long long 
#define fast  ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define test() ll t;cin>>t;while(t--)
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define newline cout<<"\n"
#define um unordered_map
#define all(x) x.begin(),x.end()
#define sot(x) sort(x.begin(),x.end())
#define rsot(x) sort(x.begin(),x.end(),greater<ll>())

using namespace std;

void solve()
{
	ll q,z,N,n,x,y,p,k,m,flag,M=0;

    cin>>n;
    string s;
    cin>>s;

    if((s[0]=='2'&&s[1]=='0'&&s[2]=='2'&&s[3]=='0' )|| (s[n-4]=='2'&&s[n-3]=='0'&&s[n-2]=='2'&&s[n-1]=='0'))
    {
        cout<<"YES";
    }
    else if((s[0]=='2'&&s[n-3]=='0'&&s[n-2]=='2'&&s[n-1]=='0') || (s[0]=='2'&&s[1]=='0'&&s[n-2]=='2'&&s[n-1]=='0') || (s[0]=='2'&&s[1]=='0'&&s[2]=='2'&&s[n-1]=='0'))
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }
    
    
}

int main()
{	
		
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	fast;
	test()
	{
		solve();	
		newline;
	}

//			solve();			

	return 0;
}