#include <iostream>
#include <utility>
#include <queue>
#include <vector>
#include <cstring>
#include <iterator>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <string>
#include <deque>
#include <algorithm>
#define endl "\n"
#define pb push_back
#define ll long long int
using namespace  std;
ll mod=1e9+7;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin>>t;
  ll ar[500];
  while(t--)
  {
      int n;
      cin>>n;
      string s,s1,s2,s3,s4,s6,s7;
      cin>>s;
      if(n<=3)cout<<"NO"<<endl;
      else
      {
          s1=s.substr(0,4);
          s2=s.substr(n-4,4);
          s3=s.substr(0,2),s4=s.substr(n-2,2);
          s6=s.substr(n-3,3);
          s7=s.substr(0,3);
          int f=0;
          if(s1=="2020"||s2=="2020")f=1;
          else if(s3=="20"&&s4=="20")f=1;
          else if(s[0]=='2'&&s6=="020")f=1;
          else if(s7=="202"&&s[n-1]=='0')f=1;
          if(f)cout<<"YES"<<endl;
          else cout<<"NO"<<endl;
      }
  }
  return 0;
}