for _ in range(int(input())):
n=int(input())
s=input()
ans='NO'
substring=n-4
for i in range(5):
if s[:i]+s[i+substring:]=='2020':
ans='YES'
break
print(ans)
#include<bits/stdc++.h>
#define ll long long
#define VL vector<ll>
const int MAX=1e4+1;
using namespace std;
void solve()
{ int n ; cin>>n;
string s;
cin>>s;
ll w=n-4;
int a[5][4]={
{0 , 1, 2, 3}, {0 , 1, 2, n-1}, {0 , 1, n-2, n-1} , {0 , n-3, n-2, n-1} , {n-4 , n-3, n-2, n-1}
};
bool f=0;
for(int i=0 ; i< 5 ; i++){
string st="";
for(int j=0 ; j< 4 ; j++){
st+=s[a[i][j]];
}
// cout<<st<<endl;
if(st=="2020"){
f=1;
break;
}
}
if(f)cout<<"YES\n";
else cout<<"NO\n";
}
int main()
{
ll t=1; cin>>t;
while(t--) solve();
return 0;
}
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |
e-maze-in | Bricks Game |
Char Sum | Two Strings |
Anagrams | Prime Number |
Lexical Sorting Reloaded | 1514A - Perfectly Imperfect Array |
580A- Kefa and First Steps | 1472B- Fair Division |