﻿#include <stdio.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <time.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#pragma warning(disable:4996)
#pragma warning(disable:6031)
#define MAX(X,Y) (X>Y?X:Y)
#define MIN(X,Y) (X<Y?X:Y)
#define ll long long
#define pii pair<int,int>
using namespace std;

int t,n;
char str[201];

int main() {
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		for (int i = 0; i < n; i++) scanf(" %c", &str[i]);
		bool ans = false;
		if (str[0] == '2') {
			if (str[1] == '0') {
				if (str[2] == '2') {
					if (str[3] == '0') ans = true;
					else if (str[n - 1] == '0') ans = true;
				}
				else if (str[n - 1] == '0' && str[n - 2] == '2') ans = true;
			}
			else if (str[n - 1] == '0' && str[n - 2] == '2' && str[n - 3] == '0') ans = true;
		}
		else if (str[n - 1] == '0' && str[n - 2] == '2' && str[n - 3] == '0' && str[n - 4] == '2') ans = true;
		printf("%s\n", (ans ? "YES" : "NO"));
	}
}
