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