#include<bits/stdc++.h>
using namespace std;
int main(){
    int t,n;
    cin>>t;
    while(t--){
        string s;
        cin>>n>>s;
        bool is=0;
        int i=0;
            if(s[i]=='2' && s[i+1]=='0' && s[i+2]=='2'&&s[i+3]=='0'){
                is=1;
            }
        i=n-4;
        if(s[i]=='2' && s[i+1]=='0' && s[i+2]=='2'&&s[i+3]=='0'){
            is=1;
        }
        if(s[0]=='2'&&s[1]=='0'&&s[n-2]=='2'&&s[n-1]=='0'){
            is=1;
        }
        if(s[0]=='2'&&s[n-3]=='0'&&s[n-2]=='2'&&s[n-1]=='0'){
            is=1;
        }
        if(s[0]=='2'&&s[1]=='0'&&s[2]=='2'&&s[n-1]=='0'){
            is=1;
        }
        if(is){
            cout<<"YES\n";
        }
        else{
            cout<<"NO\n";
        }
    }
}
