#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		string s;
		cin>>s;

		if(s.substr(0,1).compare("2")==0&&s.substr(s.size()-1,1).compare("0")==0)
		{

			if(s.substr(1,1).compare("0")==0&&s.substr(s.size()-2,1).compare("2")==0)
				cout<<"YES";

			else if(s.substr(1,2).compare("02")==0)
				cout<<"YES";
			else if(s.substr(s.size()-3,2).compare("02")==0)
				cout<<"YES";

			else
				cout<<"NO";
		}
		else if(s.substr(0,4).compare("2020")==0)
				cout<<"YES";
			else if(s.substr(s.size()-4,4).compare("2020")==0)
				cout<<"YES";
		else
			cout<<"NO";
		cout<<"\n";
	}
}
