#include<bits/stdc++.h>
#include<string>
#define all(x) x.begin(), x.end()
#define srt(x) sort(all(x))
#define rev(x) reverse(all(x))
#define uni(x) sort(all(x)), x.erase(unique(all(x)), x.end())
#define pb push_back
#define dem(x,so) count(all(x),so)
#define rep(i,n)          for(int i = 0; i < n; i++)
#define rep1(i,n)         for(int i = 0; i < n; i++)
#define re(i,n)           for(int i = 1; i <= n; i++)
#define sz(x)             (int) x.size()
#define mx(x)             *max_element(x,x+ sizeof(x)/sizeof(x[0]))
#define lli long long int
#define mp make_pair()
#define ff first
#define ss second
#define pii pair<int,int>
//vector<pair<int,int>>list;
//list.push_back(make_pair(x,y));
using namespace std;

bool isPowerOfTwo (int x)
{
    return x && (!(x&(x-1)));
}
int mostFrequent(int arr[], int n)
{
    unordered_map<int, int> hash;
    for (int i = 0; i < n; i++)
        hash[arr[i]]++;
    int max_count = 0, res = -1;
    for (auto i : hash) {
        if (max_count < i.second) {
            res = i.first;
            max_count = i.second;
        }
    }
    return res;
}
void fast()
{
	ios_base::sync_with_stdio(false);
	cout.tie(NULL);
	cin.tie(NULL);
}

void solve()
{
    int m;
    cin>>m;
    string str;
    cin>> str;
    if(str[0]=='2' && str[m-3]=='0'&& str[m-2]=='2'&& str[m-1]=='0'){
        cout<<"YES"<<endl;
        return;
    }else if(str[0]=='2' && str[1]=='0'&& str[m-2]=='2'&& str[m-1]=='0'){
        cout<<"YES"<<endl;
        return;
    }else if(str[0]=='2' && str[1]=='0'&& str[2]=='2'&& str[m-1]=='0'){
        cout<<"YES"<<endl;
        return;
    }else if(str[0]=='2' && str[1]=='0'&& str[2]=='2'&& str[3]=='0'){
        cout<<"YES"<<endl;
        return;
    }else if(str[m-4]=='2' && str[m-3]=='0'&& str[m-2]=='2'&& str[m-1]=='0'){
        cout<<"YES"<<endl;
        return;
    }
    cout<<"NO"<<endl;

}

int main(){
fast();

lli t;
cin>>t;
while(t--){
solve();
}
return 0;
}
