#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef long double ld;
#define f first
#define s second
 
const int N = 1e5 + 100;
const ll base = 313;
const ll mod = 1e9 + 7;
const ll inf = 1e16;

int a[N], ans[N];

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int q;
	cin >> q;
	while(q--)
	{
		int n;
		string s;
		cin >> n >> s;
		int cnt = 0, cnt2 = 0;
		for(int i = 0; i < 4; i++)
		{
			if((i%2 == 0 && s[i] == '2') || (i%2 == 1 && s[i] == '0'))
				cnt++;
			else	
				break;	
		}	
		
		for(int i = n-1; i >= n-4; i--)
		{
			if((i%2 == n%2 && s[i] == '2') || (i%2 != n%2 && s[i] == '0'))
				cnt2++;
			else	
				break;	
		}	
		
		if(cnt + cnt2 >= 4)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
		
		
		
	}
	

    return 0;
}


 
 
