#include<bits/stdc++.h>
using namespace std;
int main()
{

    int n,i,j,cnt,ara2[20000],m;
    string ss;
    cin>>m;
    for(i=0;i<m;i++)
    {
    cin>>n;
    cin>>ss;

    if((ss[0]=='2')&&(ss[n-1]=='0')&&(ss[n-2]=='2')&&(ss[n-3]=='0'))
    {
        cout<<"Yes"<<endl;
    }
    else if((ss[0]=='2')&&(ss[n-1]=='0')&&(ss[n-2]=='2')&&(ss[1]=='0'))
    {
        cout<<"Yes"<<endl;
    }
    else if((ss[0]=='2')&&(ss[1]=='0')&&(ss[2]=='2')&&(ss[n-1]=='0'))
    {
        cout<<"Yes"<<endl;
    }
    else if((ss[0]=='2')&&(ss[1]=='0')&&(ss[2]=='2')&&(ss[3]=='0'))
    {
        cout<<"Yes"<<endl;
    }
    else if((ss[n-1]=='0')&&(ss[n-2]=='2')&&(ss[n-3]=='0')&&(ss[n-4]=='2'))
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}
}
