#include<iostream>
#include<cstring>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string.h>
using namespace std;
typedef long long ll;
const int maxn=2e4+10;
const int inf=99999999;
int a[maxn];
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
string s;
cin>>s;
int le=s.length();
if(s=="2020")
{
cout<<"YES"<<endl;
}
else
{
if(s[0]=='2'&&s[1]=='0'&&s[2]=='2'&&s[3]=='0')
{
cout<<"YES"<<endl;
}
else if(s[0]=='2'&&s[1]=='0'&&s[2]=='2'&&s[le-1]=='0')
{
cout<<"YES"<<endl;
}
else if(s[0]=='2'&&s[1]=='0'&&s[le-2]=='2'&&s[le-1]=='0')
{
cout<<"YES"<<endl;
}
else if(s[0]=='2'&&s[le-3]=='0'&&s[le-2]=='2'&&s[le-1]=='0')
{
cout<<"YES"<<endl;
}
else if(s[le-4]=='2'&&s[le-3]=='0'&&s[le-2]=='2'&&s[le-1]=='0')
{
cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
}
}
}