#include <bits/stdc++.h>
 
using namespace std;

// ====== PBDS begins ======
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<pair<long long int,long long int>, null_type,
// 		less<pair<long long int,long long int>>, rb_tree_tag, 
// 		tree_order_statistics_node_update> 
// 		oset;
// ====== PBDS ends ======

#define endl "\n"
#define int long long
#define ll long long
#define vi vector <int>
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define maxe *max_element
#define mine *min_element
#define pow2(n) (1LL << (n))
#define sz(a) (int)a.size()
#define maxf(a,b) a=max(a,b);
#define MOD 1000000007
#define PI 3.14159265359

inline ll add(ll a, ll b){ return ((a%MOD)+(b%MOD))%MOD;}
inline ll mul(ll a, ll b){ return ((a%MOD)*(b%MOD))%MOD;}
inline ll sub(ll a, ll b){ return ((a%MOD)-(b%MOD)+MOD)%MOD;}

// const int N = 1e5+7;
// const int INF = -1e9;
 
#define deb(x) {x}
#ifndef local
	#define deb(x) ;
#endif

/*
Things to remeber : 
1. In pq use struct for comparator and 
	it is always inverse of wt we need. like :
struct cmp { 
	bool operator()(pair<int,int> a, pair<int,int> b){
		// if we want to pop elements
		// with lower ff first
		return a.first>b.first;
	}
}
push, pop, top, size functions for pq
2. In oset we use s.order_of_key(k) for number
	of elements strictly less that k and
	s.find_by_order(k) for interator to 
	kth element (0 indexed).
	We can also use s.erase(s.find(val)) to delete
	element with value val in log(n)
*/

///---------------------------------------------------------

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

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	
	#ifdef local
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	clock_t qwertyuiop = clock();
	#endif
 
	int t=1;
	cin>>t;
	rep(a,0,t)
	{
		// cout<<"Case #"<<a+1<<": ";
		solve();
	}

	// solve();
	
	#ifdef local
	{qwertyuiop = clock() - qwertyuiop;
	double time_taken = ((double)qwertyuiop)/CLOCKS_PER_SEC;
	cerr<<fixed<<setprecision(5)<<"\n\nTime Taken : "
	<<time_taken<<" seconds\n";}
	#endif
}