#include <bits/stdc++.h>

using namespace std;

int T;
int n;
string s, c = "2020";

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	cin >> T;
	while (T --) {
		cin >> n >> s;
		
		bool ok = false;
		for (int i = 0; i <= 4; ++i) {
			if (s.substr(0, i) == c.substr(0, i) && s.substr(n - 4 + i, 4 - i) == c.substr(i, 4 - i)) {
				ok = true;
				break;
			}
		}
		
		ok ? cout << "YES\n" : cout << "NO\n"; 
	}
	
	return 0;
}
