#include<bits/stdc++.h>

using namespace std;

int main()
{
    int q;
    cin >> q;

    while(q>0)
    {
        string s;
        int n;
        cin >> n >> s;

     //   cout << s.substr(0,4) << "HI";

        if(s.substr(0,4) == "2020")
            cout << "YES";
       else if(s.substr(0,3)=="202" and s[s.length()-1]=='0')
            cout << "YES";

        else if(s.substr(0,2)=="20" and s.substr(s.length()-2,2) =="20" )
            cout << "YES";

        else if(s[0]=='2' and s.substr(s.length()-3 , 3) == "020")
            cout << "YES";

        else if(s.substr(s.length()-4, 4)=="2020")
            cout << "YES";

        else
            cout << "NO";

       cout << endl;
        q--;
    }
    return 0;
}
