/******************************
 *    بسم الله الرحمن الرحيم     *
 *    author :  rion_cse      *
 *    created:  15.12.2020    *
 ******************************/

/*******************************************************
 *  ***--> ISLAMIC UNIVERSITY OF BANGLADESH <--***     *
 *  ***--> COMPUTER SCIENCE AND ENGINEERING <--***     *
 *******************************************************/

#include<bits/stdc++.h>
const int MOD=1e6+3;

#define  pf                 printf
#define  sc                 scanf

#define  s1(n)              scanf("%d",&n)
#define  s2(n1,n2)          scanf("%d %d",&n1,&n2)
#define  s3(n1,n2,n3)       scanf("%d %d %d",&n1,&n2,&n3)
#define  s4(n1,n2,n3,n4)    scanf("%d %d %d %d",&n1,&n2,&n3,&n4)

#define  ss1(n)             scanf("%lld",&n)
#define  ss2(n1,n2)         scanf("%lld %lld",&n1,&n2)
#define  ss3(n1,n2,n3)      scanf("%lld %lld %lld",&n1,&n2,&n3)
#define  ss4(n1,n2,n3,n4)   scanf("%lld %lld %lld %lld",&n1,&n2,&n3,&n4)

#define  p1(x)              printf("%I64d",x)
#define  p2(x,y)            printf("%I64d %I64d",x,y)
#define  p3(x,y,z)          printf("%I64d %I64d %I64d",x,y,z)

#define  fi(i,a,b)          for(long long i=a;i<=b;i++)
#define  f0(i , a)          for(long long i=0;i<a;i++)
#define  fm(i , a)          for(long long i=1;i<=a;i++)
#define  fd(i,a,b)          for(long long i=b;i>=a;i--)
#define  f1(a , i)          for(long long i=a-1;i>=0;i--)

#define  clr(x)             memset(x,0,sizeof(x))
#define  cln(x)             memset(x,-1,sizeof(x))

#define  fr                 freopen("input.txt","r",stdin);
#define  fw                 freopen("output.txt","w",stdout);
///sort(arr,arr+n,greater<int>()) || n!=n is NOT operation
///set<int>set;
///set<int>::itearator it;
typedef long long int ll;
using namespace std;
ll ar[505][505];
char ch[505][505];
///map<int,int>mp,mpp;

int main()
{
    int t;
    s1(t);
    while(t--)
    {
        ll n,i,sz,cnt=0,k;
        string s;
        cin>>n;
        cin>>s;
        sz=s.size();
        if(s[0]=='2' and s[1]=='0' and s[2]=='2' and s[3]=='0')
            cout<<"YES"<<endl;
        else if(s[sz-4]=='2' and s[sz-3]=='0' and s[sz-2]=='2' and s[sz-1]=='0')
            cout<<"YES"<<endl;
        else if(s[0]=='2' and s[sz-3]=='0' and s[sz-2]=='2' and s[sz-1]=='0')
            cout<<"YES"<<endl;
        else if(s[0]=='2' and s[1]=='0' and s[2]=='2' and s[sz-1]=='0')
            cout<<"YES"<<endl;
        else if(s[0]=='2' and s[1]=='0' and s[sz-2]=='2' and s[sz-1]=='0')cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}
