// Sumonto Chatterjee
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f1(a,b) for(ll i=a;i<=b;i++)
#define f2(a,b) for(ll j=a;j<=b;j++)
#define f3(a,b) for(ll k=a;k<=b;k++)
#define fr(a,b) for(ll r=a;r>=b;r--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define vll vector<long long int>
#define LL (ll)
ll Mod = 1000000007;
ll mult_inv(ll a1, ll m2)
{
    ll m1=m2,y1=0,x1=1;
    if(m2==1)
        return 0;
    while(a1>1)
    {
        ll q1=a1/m2,t1=m2;
        m2=a1%m2,a1=t1;
        t1=y1;
        y1=x1-q1*y1;
        x1=t1;
    }
    if(x1<0)
        x1+=m1;
    return x1;
}
vll sieve(1e6+10,0);
void make_sieve()
{
    sieve[1]=sieve[0]=1;
    f1(2,1e6+5)
        if(!sieve[i])
            for( ll u=2*i; u<=1e6+10;u+=i)
                sieve[u]=i;
}
ll modpow(ll x,ll n,ll m)
{
    if(!n) return 1%m;
    ll u=modpow(x,n/2,m);
    u=(u*u)%m;
    if(n&1) u=(u*x)%m;
    return u;
}
void solve()
{
	ll n;
	cin>>n;
	string s;
	cin>>s;
	string temp="2020";
	ll index=0, cnt=0;
	while(s[index]==temp[index])
	{
		index++;
		cnt++;
	}
	index=0;
	while(s[n-1-index]==temp[3-index])
	{
		index++;
		cnt++;
	}
	if(cnt>=4)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t; cin>>t; while(t--)
    solve();
}
