#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<numeric>
#include<limits>
#include<climits>
#include<limits.h>
#include<math.h>
#include<cmath>
#include<cstring>

#define forvec(vect) for (int i = 0; i < vect.size(); i++) cout << vect[i] << "\n";
#define cincout cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);

using namespace std;

int t, n;
string s, part;

int main() {
    cin >> t;

    while (t--)
    {
        bool found = false;
        int backlen = 4;

        cin >> n;
        cin >> s;

        cout << (s.length() >= 4 and (s.substr(0, 4) == "2020" or s.substr(0, 3) + s.substr(s.size() - 1, 1) == "2020" or s.substr(0, 2) + s.substr(s.size() - 2, 2) == "2020" or s.substr(0, 1) + s.substr(s.size() - 3, 3) == "2020" or s.substr(s.size() - 4, 4) == "2020") ? "YES" : "NO") << endl;
    }
} 