#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

inline void file () {
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
}

inline void solve () {
	int len; string s;
	cin >> len >> s;
	
	for(int i = 0; i <= 4; ++ i) if(s.substr(0, i) + s.substr(len - 4 + i, 4 - i) == "2020") { printf("YES\n"); return; }
	printf("NO\n");
}

int main () {

	int T;
	cin >> T;
	while(T -- ) solve();

	return 0;
}

