#include<bits/stdc++.h>

#define inp 200005
#define check exit(0)
#define nl cout<<endl;
#define mod 1000000007 
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(v) for(int i=0;i<v.size();i++) {cout<<v[i]; (i==v.size()-1) ? cout<<"\n":cout<<" "; }

using namespace std;

// Pick yourself up, 'cause...

int main()
{
    jaldi

    int t;
    cin>>t;

    while(t--)
    {
        int n;
        cin>>n;

        string s;
        cin>>s;

        bool ans = false;

        for(int i=1;i<=3;i++)
        {
            string t1="",t2="";

            for(int j=0;j<i;j++) t1+=s[j];
            for(int j=n-(4-i);j<n;j++) t2+=s[j];

            // cout << t1+t2<<"\n";
            if(t1+t2=="2020") ans=true;
        }

        if(s.substr(0,4)=="2020" || s.substr(n-4,4)=="2020") ans = true;
        cout << (ans?"YES\n":"NO\n");
    }

    return 0;
}
// Try till you are out of ideas