/*
@author: Saurav Sihag
*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define ff first
#define ss second
#define lld long double

template <class T>
void print(vector<T>& v){
    for(T x:v) cout<<x<<" ";
    cout<<"\n";
}


void inp(vector<int>& v, int n){
    for (int i=0; i<n; ++i) scanf("%d", &v[i]);
}

const int nax=1e+9+5;
// const int inf=1e+9+5;
const ll mod=1e+9+7;
// const ll mod=998244353;
// const ll nax=1e+17+5;
// const int dx[4]={0,0,-1,1};
// const int dy[4]={1,-1,0,0};



void sol(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    string r="2020";
    int i=0, j=3;
    while (i<4 && s[i]==r[i]) i++;
    while (j>-1 && s[j+n-4]==r[j]) j--;
    if (j<i) printf("YES\n");
    else printf("NO\n");
    return;
}



int main() {
    int t;
    // t=1;
    cin>>t;
    t++;
    // std::cout << std::setprecision(20);
    for (int i=1; i<t; ++i){ 
        // printf("Case #%d: ", i);
        sol();
    }
    return 0;
}