#include<bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
	int t;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		char a[n + 1];
		for(int i = 1; i <= n; i++) cin >> a[i];
		if(n < 4) cout << "NO" << endl;
		else{
			if(a[1] == '2'){
				if(a[2] == '0'){
					if(a[3] == '2'){
						if(a[4] == '0') cout << "YES" << endl;
						else if(a[n] == '0') cout << "YES" << endl;
						else cout << "NO" << endl;
					}
					else if(a[n - 1] == '2' && a[n] == '0') cout << "YES" << endl;
					else cout << "NO" << endl;
				}
				else if(a[n - 2] == '0' && a[n - 1] == '2' && a[n] == '0') cout << "YES" << endl;
				else cout << "NO" << endl;
			}
			else if(a[n - 3] == '2' && a[n - 2] == '0' && a[n - 1] == '2' && a[n] == '0') cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

 	 	   	 	 		  	 			  		 	    	