#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
 
using namespace std;
 
 
int main()
{
    ios;
    int x1 ,x2;
    int t;
    cin>>t;
    while (t--)
    {
        string st;
        int n;
        cin>>n;
        cin>>st;
        if((st[0]=='2'&&st[1]=='0')&&(st[n-2]=='2'&&st[n-1]=='0')) cout<<"YES\n";
        else if((st[0]=='2'&&st[n-3]=='0')&&(st[n-2]=='2'&&st[n-1]=='0')) cout<<"YES\n";
        else if((st[n-4]=='2'&&st[n-3]=='0')&&(st[n-2]=='2'&&st[n-1]=='0')) cout<<"YES\n";
        else if((st[0]=='2'&&st[1]=='0')&&(st[2]=='2'&&st[3]=='0')) cout<<"YES\n";
        else if((st[0]=='2'&&st[1]=='0')&&(st[2]=='2'&&st[n-1]=='0')) cout<<"YES\n";
        else cout<<"NO\n";
    }
}