#include<bits/stdc++.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
//#define int long long
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define operation(); ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
#define srt sort(ar,ar+n)
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define cn for(int i=0;i<n;i++) cin>>ar[i]
const int inf=10e+15;
int dx[8] = {-1,0,1,1,1,0,-1,-1};
int dy[8] = {1,1,1,0,-1,-1,-1,0};
int dx1[4] = {0,1,0,-1};
int dy1[4] = {1,0,-1,0};
int ar[300001];
int arr[300001];
int mm[300001];
int arra[300001];
map<int ,int >mp;
map<pair<int,int>,int>mpp;
vector<int>vis[200001];
pair<int ,string>p[300001];
pair<int ,int >pr[200001];
int a,b,c,d,e,f,t,k,sum,g,h,n,m,i,j;
//vector<int>v;
set<int >st;
int gcd(int a,int b)
{
if(b==0)
return a;
return gcd(b,a%b);
}
string s,s1,s2;
long long int dis[200001];
//vector<long long int>v(2000001);
vector<long long int >v;
queue<pair<int ,int > >q;
//int ar[201][201];
pair<int,int>cr[300001];
int cnt=0;
int main()
{
operation();
int tt;
cin>>tt;
while(tt--)
{
string s;
int n;
cin>>n;
cin>>s;
int k=-1;
for(int i=n-1;i>=0;i--)
{
if(s[i]=='8')
{
k=i;
}
}
// cout<<k<<endl;
if(k==-1)
no
else
{
k=n-k;
if(k>=11)
yes
else
no;
}
}
}
151A - Soft Drinking | 1352A - Sum of Round Numbers |
281A - Word Capitalization | 1646A - Square Counting |
266A - Stones on the Table | 61A - Ultra-Fast Mathematician |
148A - Insomnia cure | 1650A - Deletions of Two Adjacent Letters |
1512A - Spy Detected | 282A - Bit++ |
69A - Young Physicist | 1651A - Playoff |
734A - Anton and Danik | 1300B - Assigning to Classes |
1647A - Madoka and Math Dad | 710A - King Moves |
1131A - Sea Battle | 118A - String Task |
236A - Boy or Girl | 271A - Beautiful Year |
520B - Two Buttons | 231A - Team |
479C - Exams | 1030A - In Search of an Easy Problem |
158A - Next Round | 71A - Way Too Long Words |
160A - Twins | 1A - Theatre Square |
1614B - Divan and a New Project | 791A - Bear and Big Brother |