A telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephone number, but the sequences 70011223388 and 80000011223388 are not.

You are given a string $s$ of length $n$, consisting of digits.

In one operation you can delete any character from string $s$. For example, it is possible to obtain strings 112, 111 or 121 from string 1121.

You need to determine whether there is such a sequence of operations (possibly empty), after which the string $s$ becomes a telephone number.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 100$) — the number of test cases.

The first line of each test case contains one integer $n$ ($1 \le n \le 100$) — the length of string $s$.

The second line of each test case contains the string $s$ ($|s| = n$) consisting of digits.


-----Output-----

For each test print one line.

If there is a sequence of operations, after which $s$ becomes a telephone number, print YES.

Otherwise, print NO.


-----Example-----
Input
2
13
7818005553535
11
31415926535

Output
YES
NO



-----Note-----

In the first test case you need to delete the first and the third digits. Then the string 7818005553535 becomes 88005553535.

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Complete search

Greedy algorithms


Solutions:
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	l = list(s)
	a = ' '
	d = 0
	if l.count('8') == 0:
		a = 'NO'
	else:
		d = n - l.index('8')
		if d >= 11:
			a = 'YES'
		else:
			a = 'NO'
	print(a)


for _ in range(int(input())):
	n = int(input())
	s = input()
	print('NYOE S'[n - s.find('8') >= 11 and s.find('8') != -1::2])


t = int(input())
for i in range(t):
	n = int(input())
	s1 = input()
	s = ''
	for i in range(n):
		s += s1[n - i - 1]
	for i in range(10, len(s)):
		if s[i] == '8':
			print('YES')
			break
	else:
		print('NO')


t = input()
t = int(t)
temp = [0]
numbers = []
for i in range(t):
	n = input()
	n = int(n)
	numbers.append(input())
	if n >= 11:
		for j in range(n - 10):
			if numbers[i][j] == '8':
				temp[i] = 1
				break
	temp.append(0)
for i in range(t):
	if temp[i] == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = input()
	if '8' in s:
		a = s.index('8')
		if n - a >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	k = n - 11
	m = 0
	for i in range(k + 1):
		if s[i] == '8':
			print('YES')
			m = 1
			break
	if m == 0:
		print('NO')
	t -= 1


T = int(input())
test = 0
while test < T:
	length = int(input())
	string = input()
	if length < 11:
		print('NO')
	else:
		yes = 0
		for i in range(length - 10):
			if string[i] == '8':
				yes = 1
				break
		if yes == 1:
			print('YES')
		else:
			print('NO')
	test += 1


k = int(input())
for i in range(k):
	n = int(input())
	OK = False
	s = input()
	if n >= 11:
		k = s.find('8')
		if k != -1 and k <= n - 11:
			OK = True
	if OK:
		print('YES')
	else:
		print('NO')


import sys
T = int(sys.stdin.readline().rstrip())
for t in range(T):
	n = int(sys.stdin.readline().rstrip())
	nums = sys.stdin.readline().rstrip()
	exist_operation = False
	for i in range(0, len(nums) - 10):
		if nums[i] == '8':
			exist_operation = True
			break
	if exist_operation:
		print('YES')
	else:
		print('NO')


from bisect import *
from collections import *
for _ in range(int(input())):
	n = int(input())
	l = list(input())
	if n < 11:
		print('NO')
		continue
	if '8' in l[:len(l) - 11 + 1]:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	x = int(input())
	s = input()
	s = list(s)
	s = [int(x) for x in s]
	flag = 0
	for i in range(len(s)):
		if s[i] == 8 or len(s) - i - 1 < 11:
			flag = i
			break
	if len(s) - flag >= 11 and s[flag] == 8:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	x = input()
	try:
		x.index('8', 0, n - 10)
		if n >= 11:
			print('YES')
		else:
			prinnt('NO')
	except:
		print('NO')


for x in range(int(input())):
	n = int(input())
	s = list(input())
	a = []
	i = 0
	for y in s:
		if int(y) == 8:
			a.append(i)
			break
		i += 1
	if len(a) == 1:
		t = int(a[0])
		if n - t > 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for m in range(int(input())):
	n = int(input())
	s = str(input())
	if '8' in s:
		if len(s) - 1 - s.index('8') >= 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if not '8' in s:
		print('NO')
	else:
		x = s.index('8')
		if n - x >= 11:
			print('YES')
		else:
			print('NO')


T = int(input())
for i in range(T):
	n = int(input())
	print(['NO', 'YES']['8' in input()[:-10]])


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	print('YES' if '8' in s[:-10] else 'NO')


n = int(input())
for i in range(n):
	f = 0
	s = int(input())
	k = input()
	for j in range(s - 10):
		if k[j] == '8':
			f = 1
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


for q in range(int(input())):
	n = int(input())
	s = input()
	while s[0] != '8' and len(s) > 10:
		s = s[1:]
	if s[0] == '8' and len(s) >= 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	input()
	telephone = input()
	ind = telephone.find('8')
	if ind == -1:
		print('NO')
	elif len(telephone) - ind >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = int(input())
	tel = input()
	if not '8' in tel or l - tel.index('8') < 11:
		print('NO')
	else:
		print('YES')


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def is_prime(n):
	m = 2
	while m * m <= n:
		if n % m == 0:
			return False
		m += 1
	return True

def find_sum(n, a):
	a.insert(0, 0)
	for i in range(1, n + 1):
		prev = a[i] & a[i - 1]
		cur = a[i] | a[i - 1]
		a[i - 1] = prev
		a[i] = cur
	return sum((m * m for m in a))

def prin_abc(x, y, z):
	l = [x, y, z]
	l.sort()
	if l[1] < l[2]:
		print('NO')
		return
	a = b = l[0]
	c = l[2]
	print('YES')
	print(a, b, c)

def get_scores(n, vals):
	l = 0
	r = n - 1
	turn = 0
	sereja = 0
	dima = 0
	while l <= r:
		if vals[l] > vals[r]:
			cur = vals[l]
			l += 1
		else:
			cur = vals[r]
			r -= 1
		if turn == 0:
			sereja += cur
		else:
			dima += cur
		turn = not turn
	print(sereja, dima)

def count_lamps(n, m):
	return (n * m + 1) // 2

def find_holidays(n):
	cnt = 2 * (n // 7)
	rem = n % 7
	mx = mn = cnt
	if rem == 1:
		mx += 1
	elif rem > 1:
		mx += 2
	if rem == 6:
		mn += 1
	print(mn, mx)

def nc2(n):
	return n * (n - 1) // 2

def possible_phone_number(n, s):
	index = -1
	for i in range(n):
		if s[i] == '8':
			index = i
			break
	return index != -1 and n - index >= 11
t = 1
t = int(input())
while t:
	t = t - 1
	(k, g) = (0, 0)
	points = []
	n = int(input())
	a = input()
	if possible_phone_number(n, a):
		print('YES')
	else:
		print('NO')


def solve(str):
	flag = False
	for i in range(len(str)):
		if str[i] == '8':
			if n - i >= 11:
				flag = True
				break
	if flag:
		print('YES')
	else:
		print('NO')
test_case = int(input())
for i in range(test_case):
	n = int(input())
	str = input()
	solve(str)


t = int(input())
while t:
	n = int(input())
	s = input()
	if '8' in s[:n - 10] and n >= 11:
		print('YES')
	else:
		print('NO')
	t -= 1


num_tests = int(input())
tests = [[] for i in range(num_tests)]
for i in range(num_tests):
	num_char = input()
	tests[i] = [int(x) for x in list(input())]
for test in tests:
	found = False
	for i in range(len(test)):
		if test[i] == 8:
			found = True
			if len(test) - i >= 11:
				print('YES')
			else:
				print('NO')
			break
	if not found:
		print('NO')


for _ in range(int(input())):
	k = int(input())
	s = str(input())
	p = s.find('8')
	if p == -1:
		print('NO')
	elif k - p >= 11:
		print('YES')
	else:
		print('NO')


b = int(input())
for i in range(b):
	d = int(input())
	a = input()
	c = f = 0
	for x in a:
		if x == '8':
			f = 1
			break
		c += 1
	c = d - c
	if c >= 11 and f == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	number = input()
	ans = 'NO'
	for j in range(n):
		if n - j >= 11 and number[j] == '8':
			ans = 'YES'
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	flag = False
	ans = False
	for i in range(len(s)):
		if s[i] == '8':
			s = s[i:]
			flag = True
			break
	if flag:
		ans = len(s) >= 11
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	if n >= 11:
		flag = False
		for i in range(n - 10):
			if a[i] == '8':
				flag = True
		if flag:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	k = int(input())
	x = input()
	t = x.find('8')
	if k - t >= 11 and t != -1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	x = int(input())
	c = 0
	d = input()
	if x < 11:
		print('NO')
	else:
		for j in range(x - 10):
			if d[j] == '8':
				print('YES')
				break
			else:
				c += 1
		if c == x - 10:
			print('NO')


def PhoneNumber():
	n = int(input())
	s = input()
	if s.count('8') > 0:
		index = s.index('8')
		if len(s[index:]) >= 11:
			print('YES')
			return
		else:
			print('NO')
	else:
		print('NO')
		return
t = int(input())
for i in range(t):
	PhoneNumber()


for i in range(int(input())):
	a = int(input())
	b = list(input())
	if len(b) >= 11:
		for j in range(abs(a - 11)):
			if b[0] == '8':
				b.pop()
			else:
				b.remove(b[0])
		if b[0] == '8' and len(b) == 11:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


r = range(int(input()))
for _ in r:
	n = int(input().strip())
	s = input().strip()
	idx = s.find('8')
	print('YES' if idx >= 0 and idx <= n - 11 and (n >= 11) else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	p = input()
	if len(p) < 11:
		print('NO')
	elif len(p) == 11:
		if p[0] != '8':
			print('NO')
		else:
			print('YES')
	elif len(p[p.find('8'):]) >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif '8' in s[0:n - 10]:
		print('YES')
	else:
		print('NO')


def teletest(s):
	if len(s) < 11:
		return 'NO'
	elif len(s) == 11:
		if s[0] == '8':
			return 'YES'
		else:
			return 'NO'
	elif '8' in s[:-10]:
		return 'YES'
	else:
		return 'NO'
tcn = int(input())
for i in range(tcn):
	tc1 = input()
	tc2 = input()
	print(teletest(tc2))


def main():
	t = int(input())
	for i in range(t):
		size = int(input())
		s = input()
		if size >= 11 and '8' in s[:size - 10]:
			print('YES')
		else:
			print('NO')
main()


n = int(input())
while n != 0:
	tf = False
	k = int(input())
	s = input()
	if len(s) < 11:
		print('NO')
	else:
		for i in range(0, len(s) - 10):
			if s[i] == '8':
				print('YES')
				tf = True
				break
		if tf == False:
			print('NO')
	n -= 1


for _ in range(int(input())):
	input()
	data = list(input())
	l = len(data)
	for i in range(l):
		if data[i] == '8':
			if l - i >= 11:
				print('YES')
				break
	else:
		print('NO')


t = int(input(''))
ans = []
for i in range(0, t):
	n = int(input(''))
	s = input('')
	if n < 8:
		ans.append(0)
		continue
	else:
		c = 0
		for j in range(0, n):
			if s[j] == '8':
				break
			else:
				c += 1
		if n - c >= 11:
			ans.append(1)
		else:
			ans.append(0)
for i in range(0, t):
	if ans[i] == 0:
		print('NO')
	else:
		print('YES')


def createNumberPhone(n, s):
	for _ in range(n):
		if len(s) < 11:
			print('NO')
			return
		elif s.startswith('8') and len(s) == 11:
			print('YES')
			return
		elif s.startswith('8'):
			s = s[:-1]
		else:
			s = s[1:]
t = int(input())
n = []
s = []
i = 0
for _ in range(t):
	n.insert(i, int(input()))
	s.insert(i, input())
	i += 1
for _ in range(t):
	createNumberPhone(n[_], s[_])


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if s.count('8') == 0:
		print('NO')
	elif s[0] == '8' and n == 11:
		print('YES')
	elif n - s.index('8') >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	a = int(input())
	x = input()
	flag = 0
	for j in range(0, a):
		if x[j] == '8' and a - j - 1 >= 10:
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')


for _ in range(int(input())):
	(n, s) = (int(input()), input())
	f = 0
	if n < 11:
		print('NO')
	else:
		for i in range(len(s)):
			if s[i] == '8' and len(s) - i > 10:
				f = 1
				break
		if f:
			print('YES')
		else:
			print('NO')


for _ in [0] * int(input()):
	input()
	print('YNEOS'[input()[:-10].find('8') < 0::2])


n = int(input())
for i in range(n):
	t = int(input())
	s = input()
	if t == 11:
		if s[0] != '8':
			print('NO')
		else:
			print('YES')
	elif t > 11:
		d = 0
		j = 0
		while len(s) - d >= 11 and s[j] != '8':
			j += 1
			d += 1
		if len(s) - d < 11:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = 0
	b = input()
	if n < 11:
		print('NO')
	else:
		for j in range(n - 10):
			if b[j] == '8':
				print('YES')
				break
			else:
				a += 1
		if a == n - 10:
			print('NO')


tc = int(input())
while tc > 0:
	tc = tc - 1
	n = int(input())
	s = input()[:n]
	for el in s:
		if el is '8':
			if n >= 11:
				print('YES')
				break
		elif el is not '8':
			n = n - 1
	else:
		print('NO')


import copy
no_of_test_case = int(input())
noLength = 11
while no_of_test_case != 0:
	input()
	no_string = input()
	no_of_test_case -= 1
	if len(no_string) < 11:
		print('No')
		continue
	elif len(no_string) == 11:
		if no_string[0] == '8':
			print('Yes')
		else:
			print('No')
		continue
	else:
		flag = False
		no_string = list(no_string)
		no_string = list(map(int, no_string))
		No_copy = copy.copy(no_string)
		no_string.sort(reverse=True)
		i = 0
		no_index = dict()
		for j in range(0, 10):
			no_index[j] = 0
		while no_string[i] >= 7 and i < len(no_string) - 1:
			no_index[no_string[i]] += 1
			i += 1
		end_string = No_copy[-10:]
		lasteight = 0
		for elem in end_string:
			if elem == 8:
				lasteight += 1
		if no_index[8] > lasteight:
			print('Yes')
		else:
			print('No')


def id_ch(s, l):
	for i in range(l):
		if s[i] == '8':
			return i
	return -1
t = int(input())
list_answer = list()
for i in range(t):
	length = int(input())
	phone = input()
	if length >= 11:
		ids = id_ch(phone, length)
		if ids <= length - 11 and ids != -1:
			list_answer.append('YES')
		else:
			list_answer.append('NO')
	else:
		list_answer.append('NO')
for i in list_answer:
	print(i)


some_n = int(input())
for i in range(some_n):
	n = int(input())
	s = input()
	if not '8' in s:
		print('NO')
		continue
	if n - s.index('8') >= 11:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, s) = (int(input()), input())
	print('YES' if '8' in s and n - s.find('8') >= 11 else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	flag = 0
	if n >= 11:
		if s[:n - 10].count('8') > 0:
			flag = 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


def sol():
	t = int(input())
	for tt in range(t):
		n = int(input())
		A = [int(item) for item in input()]
		L = len(A)
		rslt = 'NO'
		if L >= 11 and 8 in A:
			if A.index(8) == 0 or A.index(8) <= L - 11:
				rslt = 'YES'
		print(rslt)
sol()


from math import sqrt, ceil, floor, gcd, factorial
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
import string
import bisect

def printDivisors(n):
	l = []
	for i in range(2, int(sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(int(n / i))
	return l

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	t = int(input())
	while t:
		t -= 1
		n = int(stdin.readline())
		s = input()
		ans = s.find('8')
		if ans == -1:
			print('NO')
		elif len(s[ans:]) >= 11:
			print('YES')
		else:
			print('NO')
solve()


from sys import stdin, stdout
cases = int(stdin.readline().strip())
for i in range(cases):
	n = int(stdin.readline().strip())
	txt = stdin.readline().strip()
	if txt.find('8') == -1:
		stdout.write('NO\n')
		continue
	txt = txt[txt.index('8'):]
	if len(txt) >= 11:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


from itertools import dropwhile
for _ in range(int(input())):
	n = int(input())
	if len(list(dropwhile(lambda x: x != '8', input()))) >= 11:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	k = input()
	s = input()
	if len(s) == 11:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	elif len(s) > 11:
		if '8' in s:
			index = abs(s.index('8'))
			if len(s) - index >= 11:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for w in range(t):
	n = int(input())
	s = input()
	flag = 0
	for i in range(n - 10):
		if s[i] == '8':
			flag = 1
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


import re
t = int(input())
regex = re.compile('8\\d{10}')
for i in range(t):
	n = int(input())
	s = input()
	res = regex.search(s)
	if res:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for i in range(test_cases):
	digits = int(input())
	number = input()
	if '8' in number:
		if len(number[number.index('8'):]) >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


R = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, s) = (int(input()), input())
	if n >= 11:
		if s[:-10].count('8'):
			print('yes')
		else:
			print('no')
	else:
		print('no')


def main():
	for i in range(int(input())):
		n = int(input())
		s = list(input())
		if '8' in s:
			del s[:s.index('8')]
			if len(s) >= 11:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
main()


for _ in range(int(input())):
	input()
	s = input()
	if '8' in s:
		r = s.index('8')
		if len(s) - r >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
while t > 0:
	n1 = int(input())
	s = input()
	n = []
	f = 0
	for i in s:
		n.append(i)
	for i in range(len(n)):
		if n[i] == '8' and n1 - i >= 11:
			f = 1
			break
	if f == 1 and n1 >= 11:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(0, t):
	n = int(input())
	input_string = input()
	substring = input_string[:n - 10]
	if '8' in substring:
		index = 0
		for i in range(0, len(substring)):
			if substring[i] == '8':
				index = i
				break
		delete = index
		if n - delete < 11:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


def solve(n, s):
	if n < 11:
		print('NO')
	elif s.find('8') == -1:
		print('NO')
	elif n - s.find('8') >= 11:
		print('YES')
	else:
		print('NO')
T = int(input())
for i in range(T):
	n = int(input())
	s = input()
	solve(n, s)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif n >= 11 and s[n - 11] == '8':
		print('YES')
	else:
		r = n - 11
		if s[0:r].find('8') == -1:
			print('NO')
		else:
			print('YES')


cases = int(input())
for i in range(cases):
	basura = int(input())
	number = input()
	if basura <= 11:
		if number[0] is '8' and basura is 11:
			print('YES')
		else:
			print('NO')
	else:
		difference = basura - 11 + 1
		for j in range(difference):
			if number[j] is '8':
				print('YES')
				break
			if j is difference - 1:
				print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	if s.count('8') != 0:
		k = s.index('8')
	else:
		k = n
	if n - k >= 11:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from itertools import permutations

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def inc(d, c):
	d[c] = d[c] + 1 if c in d else 1

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < n

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
while t > 0:
	t -= 1
	n = fi()
	s = si()
	if s.count('8') == 0 or n - s.index('8') < 11:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	N = int(input())
	S = input()
	mini = -1
	for (i, s) in enumerate(S[::-1]):
		if s == '8':
			mini = i
	if mini >= 10:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n >= 11:
		if 0 <= s.find('8') <= n - 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i1234 in range(n):
	ln = int(input())
	s = input()
	fp = -1
	for i in range(ln):
		if s[i] == '8':
			fp = i
			break
	if fp == -1 or ln < 11:
		print('NO')
	elif ln - fp >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for x in range(n):
	_ = input()
	s = input()
	if '8' in s[:-10]:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n - 11 < 0:
		print('NO')
		continue
	else:
		for i in range(n - 11, -1, -1):
			if s[i] == '8':
				print('YES')
				break
		else:
			print('NO')


for i in [0] * int(input()):
	a = int(input()) - 11
	for i in input():
		if i == '8' or a < 0:
			break
		else:
			a -= 1
	print('NO' if a < 0 else 'YES')


t = int(input())
for j in range(0, t):
	n = int(input())
	s = input()
	flag = int(0)
	for i in range(0, n):
		if s[i] == '8' and n - i >= 11:
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')


n = int(input())
a = [input()[0:0] + input() for _ in range(n)]
print('\n'.join(['YES' if i.find('8') != -1 and len(i) - i.find('8') >= 11 else 'NO' for i in a]))


t = int(input())
while t >= 1:
	t = t - 1
	n = int(input())
	ar = input()
	l = len(ar)
	flag = 0
	g = 0
	if l == 11 and ar[0] == '8':
		flag = 1
	elif l == 11 and ar[0] != '8':
		flag = 0
	elif l < 11:
		flag = 0
	elif l > 11:
		x = l - 11
		pre = 0
		g = 1
		i = 0
		for i in range(x + 1):
			if ar[i] == '8':
				pre = 1
				break
	if flag == 1 and g == 0:
		print('YES')
	elif flag == 0 and g == 0:
		print('NO')
	elif pre == 1 and g == 1:
		print('YES')
	elif pre == 0 and g == 1:
		print('NO')


t = int(input())

def get_answer(n, nums):
	if '8' in set(nums):
		if n - nums.index('8') > 10:
			return 'YES'
	return 'NO'
for _ in range(t):
	n = int(input())
	nums = input()
	print(get_answer(n, nums))


t = int(input())
for i in range(t):
	n = int(input())
	S = str(input())
	if '8' in S[:-10]:
		print('Yes')
	else:
		print('No')


def f(j):
	(n, s) = j
	if '8' in s:
		i = s.index('8')
		if n - i >= 11:
			return 'YES'
		else:
			return 'NO'
	else:
		return 'NO'
l = []
for _ in range(int(input())):
	n = int(input())
	s = str(input())
	l.append((n, s))
ans = [f(j) for j in l]
for i in ans:
	print(i)


def fun1(num, an):
	if an > 11:
		ind = num.find('8')
		return print('YES') if an - ind >= 11 and ind >= 0 else print('NO')
	elif an < 11:
		print('NO')
	else:
		return print('YES') if num[0] == '8' else print('NO')

def sol():
	totaln = int(input())
	(nums, ns) = ([], [])
	for _ in range(totaln):
		ns.append(int(input()))
		nums.append(input())
	for i in range(totaln):
		fun1(nums[i], ns[i])
sol()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = str(input())
	if '8' in s:
		pos = 0
		for i in s:
			if i == '8':
				break
			pos += 1
		if n - pos >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


l = []
for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = 'NO'
	if n < 11:
		ans = 'NO'
	elif n == 11 and s[0] != '8':
		ans = 'NO'
	else:
		for j in range(n):
			if s[j] == '8' and n - j >= 11:
				ans = 'YES'
				break
			elif n - j + 1 < 11:
				break
	l.append(ans)
for vi in l:
	print(vi)


x = int(input())
for _ in range(x):
	a = int(input())
	c = input()
	v = c.find('8')
	if v == -1:
		print('NO')
	elif a - v >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	number = input()
	if len(number) - number.find('8') >= 11 and number.find('8') != -1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, a) = (input(), input())
	print(('NO', 'YES')[len(a[a.find('8'):]) > 10])


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	flag = 0
	if n < 11:
		pass
	else:
		for j in range(n - 10):
			if s[j] == '8':
				flag = 1
				break
	if flag:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
N = int(input())
for q in range(N):
	n = int(input())
	S = input().strip()
	if n < 11:
		print('NO')
	elif '8' in S[:n - 10]:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	if n < 11:
		print('NO')
	elif n == 11 and s[0] == '8':
		print('YES')
	elif n == 11 and s[0] != '8':
		print('NO')
	elif n > 11:
		c = 0
		for j in range(0, n - 10):
			if s[j] == '8':
				c = c + 1
		if c > 0:
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
for _ in range(int(f_input())):
	(length, string) = (int(f_input()), f_input())
	if '8' not in string:
		f_print('NO\n')
		continue
	if length - string.find('8') >= 11:
		f_print('YES\n')
	else:
		f_print('NO\n')


t = int(input().strip())
for k in range(t):
	n = int(input().strip())
	number = input().strip()
	if len(number) < 11:
		print('NO')
	else:
		for i in range(0, len(number) - 10):
			if number[i] == '8':
				print('YES')
				break
		else:
			print('NO')


n = int(input())
for i in range(n):
	p = int(input())
	l = list(input())
	r = p - 10
	flag = 0
	for j in range(r):
		if l[j] == '8':
			flag = 1
			print('YES')
			break
	if flag == 0:
		print('NO')


n = int(input())
for i in range(n):
	x = int(input())
	y = input()
	if '8' in y[:-10]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, s) = (int(input()), input())
	print('YES' if n == 11 and s[0] == '8' or (n > 11 and s[0:-10].count('8') > 0) else 'NO')


import math
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
for t in range(ii()):
	n = ii()
	s = si()
	i = s.find('8')
	if n - i - 1 >= 10 and i >= 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	n1 = int(input())
	string = input()
	if '8' in string[:-10]:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	x = int(input())
	s = input()
	for i in s:
		if i == '8':
			if x >= 11:
				print('YES')
				break
			else:
				print('NO')
				break
		else:
			x -= 1
		if x < 11:
			print('NO')
			break


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	p = n
	for j in range(n):
		if s[j] == '8' and p == n:
			p = j
	if n - p >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	s = input()
	if n < 11 or '8' not in s:
		print('NO')
	elif n - s.index('8') > 10:
		print('YES')
	else:
		print('NO')


n = int(input())
l = []
p = -1
for i in range(n):
	x = int(input())
	y = input()
	p = y.find('8')
	if x - p >= 11 and p != -1:
		l.append('YES')
	else:
		l.append('NO')
for i in l:
	print(i)


a = int(input())
for i in range(a):
	b = int(input())
	c = input()
	h = 0
	n = 0
	for i in range(b):
		if c[i] == '8' and n == 0:
			h = i + 1
			n += 1
	if h != 0 and b - (h - 1) >= 11:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	c = n - a.find('8')
	if '8' in a and c >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
length = []
number = []
for i in range(0, t):
	x = int(input())
	length.append(x)
	y = input()
	number.append(y)
for i in range(0, t):
	k = length[i] - 11
	a = number[i].find('8')
	if a is -1:
		print('NO')
	elif k >= a:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input().strip()
	print('YES' if '8' in s and s.index('8') <= n - 11 else 'NO')


for _ in range(int(input())):
	length = int(input())
	tel_num = list(input())
	for i in tel_num:
		if i == '8':
			del tel_num[:tel_num.index(i)]
			break
	if tel_num[0] == '8' and len(tel_num) >= 11:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = input()
	pos = s.find('8')
	if pos == -1:
		print('NO')
	elif n - pos - 1 >= 10:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	string_length = int(input())
	string = input()
	if string_length < 11:
		print('NO')
	elif string_length == 11:
		if string[0] == '8':
			print('YES')
		else:
			print('NO')
	else:
		no_of_eight = string.count('8')
		if no_of_eight == 0:
			print('NO')
		else:
			j = -1
			for letter in string:
				j += 1
				if letter == '8':
					break
			if len(string[j + 1:]) >= 10:
				print('YES')
			else:
				print('NO')


t = int(input())
for T in range(t):
	n = input()
	s = input()
	for i in range(len(s)):
		if s[i] is '8':
			break
	if len(s) - i >= 11:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	b = input()
	print('YES' if '8' in input()[:-10] else 'NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	eight = n
	for i in range(n):
		if s[i] == '8':
			eight = i
			break
	if n - eight >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	k = input()
	ch = n - 11
	flag = 0
	while ch > -1:
		if k[ch] == '8':
			flag = 1
			break
		ch -= 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	size = int(input())
	tel = input()
	newTel = ''
	for i in range(size):
		if newTel == '':
			if tel[i] == '8':
				newTel += tel[i]
		elif len(newTel) < 11:
			newTel += tel[i]
	if len(newTel) == 11:
		print('YES')
	else:
		print('NO')


def main():
	ri = lambda : int(input())
	ril = lambda : list(map(int, input().split()))
	rit = lambda : tuple(map(int, input().split()))
	pc = lambda c: print(''.join(map(str, c)))
	pcr = lambda c: print(' '.join(map(str, c)))
	t = ri()
	for i in range(t):
		n = ri()
		num = input()
		if '8' in set(num[:-10]):
			print('YES')
		else:
			print('NO')
	return 0
main()


c = int(input())
while c > 0:
	input()
	numero = list(input())
	while len(numero) > 0 and numero[0] != '8':
		numero.pop(0)
	if len(numero) < 11:
		print('NO')
	else:
		print('YES')
	c -= 1


def solve(s, n):
	s = str(s)
	n = int(n)
	a = [int(x) for x in s]
	pos = n + 1
	for i in range(n):
		if a[i] == 8:
			pos = i
			break
	if n - pos >= 11:
		return True
	else:
		return False
t = int(input())
for i in range(t):
	n = input()
	s = input()
	if solve(s, n):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	if n < 11:
		print('NO')
	elif n == 11:
		if a[0] == '8':
			print('YES')
		else:
			print('NO')
	elif '8' in a:
		z = a.index('8')
		if z <= n - 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	a = input()
	if len(a) < 11 or '8' not in a:
		print('NO')
	else:
		flag = 0
		for i in range(0, len(a)):
			if a[i] == '8' and len(a) - i >= 11:
				flag = 1
				break
		if flag == 1:
			print('YES')
		else:
			print('NO')


n = int(input())
gans = 'YES'
bans = 'NO'
for i in range(n):
	a = int(input())
	s = input()
	if a < 11:
		print(bans)
		continue
	elif a == 11:
		if s[0] == '8':
			print(gans)
			continue
		else:
			print(bans)
			continue
	elif s.find('8') < len(s) - 10 and s.count('8') != 0:
		print(gans)
		continue
	else:
		print(bans)
		continue


n = int(input())
for i in range(n):
	lenNum = int(input())
	num = input()
	index = num.find('8')
	if index == -1:
		print('NO')
	elif lenNum - index >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	a = int(input())
	s = input()
	flag = False
	s = s[::-1]
	for x in range(a - 1, 9, -1):
		if s[x] == '8' and x >= 10:
			flag = True
			break
	if flag == False:
		print('NO')
	else:
		print('YES')
	t -= 1


def split_char(str):
	return [char for char in str]
t = int(input())
for i in range(0, t):
	n = int(input())
	s = split_char(input())
	pos = n
	for j in range(0, len(s)):
		if s[j] == '8':
			pos = j
			break
	if n - pos >= 11:
		print('YES')
	else:
		print('NO')


from math import *
from itertools import *
for _ in range(int(input())):
	n = int(input())
	s = input()
	i = 0
	while i < n:
		if s[i] == '8':
			break
		i += 1
	s = s[i:]
	if len(s) >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	n_temp = int(input())
	temp = input()
	if temp.find('8') == -1:
		print('NO')
		continue
	if n_temp - temp.find('8') >= 11:
		print('YES')
	else:
		print('NO')


amount = int(input())
for i in range(amount):
	length = int(input())
	number = input()
	if number.find('8') > -1:
		num8Local = number.find('8')
		if length - num8Local > 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	length = int(input())
	try:
		position = input().index('8')
		if length - position > 10:
			print('YES\n')
		else:
			print('NO\n')
	except ValueError:
		print('NO\n')


import sys

def main():
	t = int(sys.stdin.readline())
	for _ in range(t):
		n = int(sys.stdin.readline())
		seq = sys.stdin.readline().rstrip()
		for i in range(n - 10):
			if seq[i] == '8':
				print('YES')
				break
		else:
			print('NO')
main()


t = int(input())
out = []
for i in range(0, t):
	n = int(input())
	s = str(input())
	check = s.find('8')
	if check == -1 or check + 11 > n:
		out = out + ['NO']
	elif check + 11 <= n:
		out = out + ['YES']
for i in range(0, t):
	print(out[i])


def testCase():
	input()
	s = input()
	return s.find('8') >= 0 and len(s) - s.find('8') >= 11
t = int(input())
ans = map(lambda x: 'YES' if testCase() else 'NO', range(t))
print('\n'.join(ans))


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		s = input()
		slist = []
		for j in s:
			slist.append(j)
		while slist and slist[0] != '8':
			slist.pop(0)
		if len(slist) < 11:
			print('NO')
		else:
			print('YES')
main()


test_cases = int(input())
for i in range(test_cases):
	length = int(input())
	string = input()
	index = string.find('8')
	if index == -1:
		print('NO')
	elif length - index >= 11:
		print('YES')
	else:
		print('NO')


result = []
number = int(input())
for m in range(number):
	digit = int(input())
	telephone = input()
	if digit < 11:
		result.append('NO')
	else:
		t_number = digit - 11
		e = 0
		for a in range(t_number + 1):
			if telephone[a] == '8':
				result.append('YES')
				e = 0
				break
			else:
				e = 1
		if e == 1:
			result.append('NO')
for m in result:
	print(m)


q = int(input())
for _ in range(q):
	input()
	number = input()
	if '8' not in number or len(number) < 11:
		print('NO')
		continue
	if number.index('8') <= len(number) - 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	p = input()
	flag = 0
	pi = 0
	for i in range(n):
		if p[i] == '8':
			flag = 1
			pi = i
			break
	if flag:
		if n - pi >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
arr = [line.strip() for line in sys.stdin]
for line in arr[2::2]:
	se = line.find('8')
	if se != -1 and len(line) - se >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	s = list(map(int, input()))
	if 8 in s:
		l = s.index(8)
		if len(s) - l >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
for _ in range(int(z())):
	x = int(z())
	l = list(map(int, z()))
	try:
		o = l.index(8)
	except:
		o = 89843589437895798347597053957923759375934597
	t = x - 11
	if o <= t:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	T = input()
	if n < 11:
		print('NO')
	else:
		yy = n
		for j in range(yy):
			if T[j] == '8':
				print('YES')
				break
			else:
				n -= 1
				if n < 11:
					print('NO')
					break


t = int(input())
for _ in range(t):
	n = input()
	s = input()
	L = []
	for i in range(len(s)):
		if s[i] == '8':
			L.append(i)
	if len(L) == 0:
		print('NO')
	elif len(s) - L[0] >= 11:
		print('YES')
	else:
		print('NO')


def check(s, n):
	if n < 11:
		return False
	f = -1
	for i in range(n - 11 + 1):
		if s[i] == '8':
			f = i
			break
	if f != -1 and n - f >= 11:
		return True
	else:
		return False
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	print('YES' if check(s, n) else 'NO')


n = int(input())
for i in range(n):
	ip1 = input()
	ip2 = input()
	a = ip2.find('8')
	if len(ip2) >= 11 and len(ip2) - a >= 11:
		if a == -1:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	arr = [int(i) for i in s]
	i = 0
	while i < n and arr[i] != 8:
		i += 1
	if n - i >= 11:
		print('YES')
	else:
		print('NO')


def solve(a):
	i = a.find('8')
	if i == -1:
		return 'NO'
	if len(a) - i >= 11:
		return 'YES'
	return 'NO'
n = int(input())
for i in range(1, n + 1):
	k = int(input())
	a = input()
	x = solve(a)
	print(x)


n = int(input())
e = []
for i in range(n):
	z = input()
	a = [len(i) for i in input().split('8', 1)]
	if len(a) >= 2 and a[1] + 1 >= 11:
		e.append('YES')
	else:
		e.append('NO')
for i in e:
	print(i)


a = int(input())
for i in range(0, a):
	c = int(input())
	b = str(input())
	k = 'NO'
	for m in range(0, c):
		if b[m] == '8' and c - (m + 1) >= 11:
			k = 'YES'
		if c - m == 11 and b[m] == '8':
			k = 'YES'
	print(k)


a = int(input())
p = 0
for i in range(a):
	p = 0
	b = int(input())
	c = input()
	if c[0] == '8' and b >= 11:
		print('YES')
	else:
		while len(c) > 11:
			c = c[1:]
			if c[0] == '8' and b >= 11:
				print('YES')
				p = 1
				break
		if p == 0:
			print('NO')


t = int(input())
for l in range(t):
	n = int(input())
	s = str(input())
	loc = n
	for i in range(n):
		if s[i] == '8':
			loc = i
			break
	if n - loc >= 11:
		print('YES')
	else:
		print('NO')


N = int(input())
for i in range(N):
	input()
	X = input()
	if '8' not in X or len(X[X.index('8'):]) < 11:
		print('NO')
	else:
		print('YES')


cases = int(input())
for _ in range(cases):
	length = int(input())
	num = input()
	eight_index = num.find('8')
	if eight_index == 0 and length == 11:
		print('YES')
	elif eight_index != -1:
		if length - eight_index >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


x = int(input())
for n in range(x):
	j = int(input())
	s = [int(n) for n in input()]
	if j < 11:
		print('NO')
	elif s.count(8) == 0:
		print('NO')
	else:
		l = s.index(8)
		if j - l >= 11:
			print('YES')
		else:
			print('NO')


def f(j):
	(n, s) = j
	if '8' not in s:
		return 'NO'
	elif s[0] == '8' and len(s) >= 11:
		return 'YES'
	else:
		i = s.index('8')
		temp = s[i:]
		if len(temp) >= 11:
			return 'YES'
		else:
			return 'NO'
l = []
for _ in range(int(input())):
	n = int(input())
	s = str(input())
	l.append((n, s))
ans = [f(j) for j in l]
for i in ans:
	print(i)


t = int(input())
for i in range(t):
	y = int(input())
	e = input()
	r = y - 10
	tyu = -1
	for i in range(r):
		if e[i] == '8':
			tyu = 0
			print('YES')
			break
	if tyu == -1:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input().strip()
	idx = s.find('8')
	if idx == -1:
		print('NO')
	else:
		print('YES' if n - idx >= 11 else 'NO')


for _ in range(int(input())):
	n = int(input())
	s = str(input())
	if '8' in s:
		i = s.index('8')
		if n - i >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input()))
	coun = 0
	for j in range(n):
		if a[j] == 8:
			break
		else:
			coun += 1
	if n - coun >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	length = int(input())
	number = input()
	if '8' in number and length - number.find('8') > 10:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	input()
	print(('NO', 'YES')[sum(map(str.isdigit, (input() + '8').split('8', 1)[1])) > 10])


nCases = int(input())
for _ in range(nCases):
	nDigets = int(input())
	number = input()
	if nDigets < 11:
		print('NO')
		continue
	for i in range(nDigets - 10):
		if number[i] == '8':
			print('YES')
			break
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = input()
	if len(s) >= 11 and s[:-10].count('8') > 0:
		print('YES')
	else:
		print('NO')


def check_eight():
	global string
	for i in string[0:-10]:
		if i == '8':
			return True
n = int(input())
for i in range(n):
	string_length = int(input())
	string = input()
	if string_length < 11:
		print('NO')
	else:
		status = check_eight()
		if status == True:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	k = int(input())
	s = input()
	if k > 10 and s.find('8') > -1 and (k - s.find('8') > 10):
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	l = list(str(input()))
	if '8' not in l:
		print('NO')
	else:
		g = l.index('8')
		if n - g >= 11:
			print('YES')
		else:
			print('NO')
	t -= 1


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
nb_test = RI()
for _ in range(nb_test):
	lens = RI()
	nums = RW()
	ans = 'NO'
	for (i, v) in enumerate(nums):
		if v == '8':
			if lens - i >= 11:
				ans = 'YES'
				break
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	s = str(input())
	if n < 10:
		print('NO')
	else:
		x = s.find('8')
		if x == -1:
			print('NO')
		elif n - x >= 11:
			print('YES')
		else:
			print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	s = input()
	pos = s.find('8')
	if pos < 0:
		print('NO')
	elif n - pos >= 11:
		print('YES')
	else:
		print('NO')


def solve(s):
	if len(s) == 11 and s[0] == '8':
		return True
	if len(s) < 11:
		return False
	if len(s) > 11:
		i = 0
		while i < len(s):
			if s[i] == '8':
				break
			i += 1
		if len(s) - i >= 11:
			return True
	return False
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	print('YES' if solve(s) else 'NO')


n = int(input())
count = 0
for i in range(n):
	l = int(input())
	s = input()
	if '8' in s:
		x = s.find('8')
		if len(s[x:]) >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
i = 0
j = 0
pos = 0
flag_1 = 0
for i in range(t):
	n = int(input())
	s = str(input())
	for j in range(n):
		if s[j] == '8':
			pos = j
			flag_1 = 1
			break
	if flag_1 == 0:
		print('NO')
	elif n - pos >= 11:
		print('YES')
	else:
		print('NO')
	flag_1 = 0


case = int(input())
for i in range(case):
	numlen = int(input())
	number = input()
	if numlen >= 11 and '8' in number[:-10]:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = int(input())
	s = input()
	t = 0
	while s[t] != '8' and a >= 11:
		a -= 1
		t += 1
	if a >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
res = list()
for i in range(t):
	n = input()
	s = input()
	if int(n) <= 10:
		res.append('NO')
		continue
	if '8' in s:
		if len(s[s.find('8'):]) - 1 >= 10:
			res.append('YES')
		else:
			res.append('NO')
	else:
		res.append('NO')
for i in res:
	print(i)


n = int(input())
for i in range(n):
	nl = int(input())
	seq = input()
	try:
		idx = seq.index('8')
	except:
		idx = nl
	print('YES') if idx + 10 < nl else print('NO')


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	yes = False
	for j in range(n):
		if j + 10 >= n:
			break
		if s[j] == '8':
			yes = True
			break
	if yes:
		print('YES')
	else:
		print('NO')


import sys
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
n = int(input())
for i in range(n):
	p = int(input())
	k = input()
	count = 0
	for i in list(k):
		if i == '8':
			break
		count += 1
	if p - count >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	try:
		s = s[s.index('8'):]
		if len(s) < 11:
			raise ValueError
		print('YES')
	except ValueError:
		print('NO')


n = int(input())
l = []
l2 = []
for i in range(n):
	o = int(input())
	u = input()
	l += [o]
	l2 += [u]
for i in range(len(l)):
	if l[i] == 11 and l2[i][0] == '8':
		print('YES')
	elif l[i] > 11:
		p = l[i] - 11
		t = l2[i][:p + 1]
		if '8' in t:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	if len(s) < 11:
		print('NO')
		continue
	l = len(s)
	ind = s.find('8')
	if ind == -1:
		print('NO')
		continue
	ll = len(s) - ind
	if ll < 11:
		print('NO')
		continue
	print('YES')


import time

def convertToTelNumber(nums):
	res = ''
	inx8 = 0
	for n in nums:
		if len(n) >= 11:
			inx8 = n.find('8')
			if inx8 >= 0:
				if inx8 + 11 <= len(n):
					res = 'YES'
				else:
					res = 'NO'
			else:
				res = 'NO'
		else:
			res = 'NO'
		print(res)
	return

def solve():
	cases = int(input())
	lenNum = 0
	numsList = []
	for x in range(cases):
		lenNum = int(input())
		phoneNum = input()
		numsList.append(phoneNum)
	convertToTelNumber(numsList)
solve()


N = int(input())
for i in range(0, N):
	length = int(input())
	number = input()
	posOf8 = number.find('8')
	if length - posOf8 > 10 and posOf8 != -1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = int(input())
	b = input()
	if a < 11:
		print('NO')
	elif '8' in b[0:a - 10]:
		print('YES')
	else:
		print('NO')


n = int(input())
for p in range(n):
	k = int(input())
	st = input()
	ans = 0
	for i in range(k):
		if st[i] == '8':
			ans = i
			break
		else:
			ans = k - 1
	if k >= 11 and ans <= k - 11:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	j = n - 11
	x = input()
	for i in x:
		if j < 0:
			print('NO')
			break
		elif i == '8':
			print('YES')
			break
		j = j - 1


n = int(input())
z = []
for i in range(n):
	x = int(input())
	a = list(input())
	for j in range(x):
		if a[j] == '8':
			break
	if x - j >= 11:
		z.append('YES')
	else:
		z.append('NO')
for i in z:
	print(i)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		a = I()
		b = S()
		if a < 11:
			ans.append('NO')
			continue
		f = True
		for i in range(a - 11 + 1):
			if b[i] == '8':
				ans.append('YES')
				f = False
				break
		if f:
			ans.append('NO')
	for x in ans:
		print(x)
main()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif n == 11:
		if s[0] != '8':
			print('NO')
		else:
			print('YES')
	elif s[0] != '8':
		if any((s[j] == '8' for j in range(n - 10))):
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


for case in range(int(input())):
	int(input())
	k = input()
	c = len(k) - 11
	print('YES' if len(k) == 11 and k[0] == '8' or (c >= k.find('8') and '8' in k) else 'NO')


t = int(input())
kq = list()
for i in range(t):
	n = int(input())
	s = input()
	if len(s) < 11:
		kq += ['NO']
	elif s.find('8') == -1:
		kq += ['NO']
	elif n - s.find('8') < 11:
		kq += ['NO']
	else:
		kq += ['YES']
for i in range(t):
	print(kq[i])


for case in range(int(input())):
	n = int(input())
	s = input()
	ans = 'NO'
	for i in range(n - 10):
		if s[i] == '8':
			ans = 'YES'
			break
	print(ans)


n = int(input())
for _ in range(n):
	length = int(input())
	phone = input()
	if length < 11:
		print('NO')
		continue
	if '8' in phone[:-10]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = max(int(input()) - 10, 0)
	a = input()
	b = a[:n]
	if '8' in b:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t = t - 1
	n = int(input())
	s = input()
	for i in range(s.find('8')):
		s = s.replace(s[i], ' ', 1)
	s = s.strip()
	if len(s) >= 11 and s.count('8') > 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for nn in range(n):
	str_length = int(input())
	number = list(input())
	count = 0
	flag = False
	for index in range(str_length):
		if number[index] == '8':
			if str_length - index > 10:
				flag = True
				break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif n == 11:
		if s[0] != '8':
			print('NO')
		else:
			print('YES')
	else:
		try:
			if s.index('8') <= n - 11:
				print('YES')
			else:
				print('NO')
		except:
			print('NO')


for i in range(int(input().strip())):
	n = int(input())
	num = input()
	print('YES' if '8' in num and n - num.index('8') >= 11 else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	index = -1
	flag = 0
	for i in range(len(s)):
		if s[i] == '8':
			flag = 1
			index = i
			break
	if flag == 1:
		if n - index >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for T in range(t):
	l = int(input())
	s = input()
	try:
		x = s.index('8')
		lx = l - x
	except:
		x = 'NO'
	if x == 'NO':
		print(x)
	elif l < 11:
		print('NO')
	elif l == 11:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	elif lx >= 11:
		print('YES')
	else:
		print('NO')


test = int(input())
val = []
result = []
x = []
i = 0
while test > 0:
	test -= 1
	val.append(input())
	x.append(input())
	flag = 0
	if len(x[i]) >= 11:
		for j in range(len(x[i]) - 10):
			if x[i][j] == '8':
				flag = 1
				break
		if flag == 1:
			result.append('YES')
		else:
			result.append('NO')
	else:
		result.append('NO')
	i += 1
for k in result:
	print(k)


i = j = 0
for j in range(int(input())):
	input()
	s = input()
	i = 0
	while i < len(s) and s[0] != '8':
		if s[i] == '8':
			s = s[i:]
		i += 1
	if len(s) >= 11 and s[0] == '8':
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, s) = (int(input()), input())
	i = s.find('8')
	print('NO' if i == -1 or n - i < 11 else 'YES')


t = int(input())
for i in range(t):
	n = int(input())
	st = input()
	if n < 11 or not '8' in st:
		print('NO')
	else:
		index = 0
		while st[index] != '8':
			index += 1
		if len(st) - index >= 11:
			print('YES')
		else:
			print('NO')


test_cases = int(input())
len1 = []
num = []
yn = []
for i in range(test_cases):
	len1 = int(input())
	num = input()
	num = list(num)
	if '8' in num:
		if len1 == 11:
			if num[0] == '8':
				c = 1
			else:
				c = 0
		elif len1 > 11:
			if len(num) - num.index('8') >= 11:
				c = 1
			else:
				c = 0
		else:
			c = 0
	else:
		c = 0
	yn.append(c)
for i in yn:
	if i == 1:
		print('YES')
	else:
		print('NO')


R = lambda : map(int, input().split())
for i in range(int(input())):
	n = int(input())
	s = input()
	f = 0
	for i in reversed(range(n - 10)):
		if s[i] == '8':
			f = 1
			break
	if f:
		print('YES')
	else:
		print('NO')


def numbers(s):
	try:
		loc = s.index('8')
		x = len(s[loc:])
		if x < 11:
			return 'NO'
		return 'YES'
	except ValueError:
		return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	print(numbers(s))


t = int(input())
for i in range(t):
	l = int(input())
	s = input()
	flag = False
	for j in range(len(s)):
		if s[j] == '8' and l - j >= 11:
			flag = True
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	if n == 11:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	elif n > 11:
		n = n - 11 + 1
		p = s[:n]
		if '8' in p:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	f = int(input())
	p = input()
	if '8' in p[:-10]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	ind = 0
	r = 0
	li = list(s)
	for i in range(n):
		if s[i] == '8':
			ind = i
			r = 1
			break
	if n - i >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	num = input()
	if '8' not in num:
		print('NO')
	else:
		for i in range(len(num)):
			if num[i] == '8':
				new = num[i:]
				break
		if len(new) >= 11:
			print('YES')
		else:
			print('NO')
	t -= 1


for i in range(int(input())):
	(n, p) = (int(input()), input().find('8'))
	print(('NO', 'YES')[p != -1 and n - p >= 11])


def f(k, s):
	if k < 11:
		return 'NO'
	else:
		mosse = k - 11
		flag = False
		for j in range(mosse + 1):
			if s[j] == '8':
				flag = True
		if flag == True:
			return 'YES'
		else:
			return 'NO'
n = int(input())
for i in range(n):
	k = int(input())
	s = input()
	print(f(k, s))


for x in range(int(input())):
	a = int(input())
	b = list(input())
	if a < 11:
		print('NO')
	elif '8' not in b:
		print('NO')
	elif len(b) - b.index('8') >= 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	print('Yes' if '8' in s and n - s.find('8') >= 11 else 'No')


t = int(input())
while t > 0:
	n = int(input())
	tel = input()
	if n >= 11 and len(tel) >= 11 and any((i == '8' for i in tel[:-10])):
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if '8' in s and len(s) - s.index('8') >= 11:
		print('YES')
	else:
		print('NO')


def telephone_number(mystr):
	if mystr is None:
		return 'NO'
	x = mystr.find('8')
	if x != -1 and abs(len(mystr) - x) >= 11:
		return 'YES'
	return 'NO'
n = int(input())
for i in range(n):
	_ = int(input())
	print(telephone_number(str(input())))


def solve(n, s):
	if n < 11:
		print('NO')
		return
	for i in range(n - 10):
		if s[i] == '8':
			print('YES')
			return
	print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	solve(n, s)


T = int(input())
while T > 0:
	_ = input()
	n = input()
	if not '8' in n or len(n) < 11:
		print('NO')
	elif len(n) == 11 and (not '8' in n):
		print('NO')
	elif len(n) - n.find('8') < 11:
		print('NO')
	else:
		print('YES')
	T -= 1


t = int(input())
while t:
	n = int(input())
	s = input()
	a = s.find('8')
	if a == -1:
		print('NO')
	else:
		q = n - (a + 1)
		if q >= 10:
			print('YES')
		else:
			print('NO')
	t = t - 1


t = int(input())
while t != 0:
	c = 0
	n = int(input())
	ind = n
	s = input()
	for i in s:
		if i == '8' and ind >= 11:
			print('Yes')
			c = 1
			break
		ind = ind - 1
	if c == 0:
		print('No')
	t = t - 1


a = int(input())
while a:
	(l, n) = (int(input()), input())
	checking = len(n)
	for i in n:
		if i != '8':
			checking -= 1
		else:
			break
	if checking >= 11:
		print('YES')
	else:
		print('NO')
	a -= 1


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	k = n - 11
	if s.find('8') == -1:
		print('NO')
	elif s.find('8') <= k:
		print('YES')
	else:
		print('NO')


no = int(input())
res = []
for i in range(no):
	n = int(input())
	s = input()
	count = 0
	for i in s:
		if i == '8':
			break
		else:
			count += 1
	if n - count >= 11:
		res.append('YES')
	else:
		res.append('NO')
for i in res:
	print(i)


for l in range(int(input())):
	n = int(input())
	s = str(input())
	flag = True
	for i in range(n):
		if s[i] == '8':
			if n - i >= 11:
				flag = False
				break
	if flag == False:
		print('YES')
	else:
		print('NO')


T = int(input())
while T:
	len = int(input())
	str = input()
	flag = False
	for i in range(len):
		if str[i] == '8':
			if len - i >= 11:
				print('YES')
				flag = True
				break
			else:
				break
	if flag == False:
		print('NO')
	T -= 1


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
from math import *
from decimal import *
from copy import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 6 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN(x=' '):
	return map(int, sys.stdin.readline().strip().split(x))

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN():
	return list(numIN())

def dis(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)
for _ in range(int(input())):
	n = int(input())
	s = [i for i in input()]
	try:
		z = s.index('8')
	except:
		print('NO')
		continue
	if n - z < 11:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	x = int(input())
	s = str(input())
	c = len(s) - 11
	if c == 0:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	elif '8' in s and c >= s.find('8'):
		print('YES')
	else:
		print('NO')


res = []
n = int(input())
for i in range(n):
	k = int(input())
	num = input()
	firstIndex = num.find('8')
	res.append('YES' if k - firstIndex >= 11 and firstIndex > -1 else 'NO')
print(*res, sep='\n')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input().strip()
	f = 0
	while f < n and s[f] != '8':
		f += 1
	if f == n or n - f < 11:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	flag3 = 0
	n = int(input())
	s = input()
	if n == 11 and s[0] == '8':
		print('YES')
	elif n == 11 and s[0] != '8' or n < 11:
		print('NO')
	elif n > 11:
		a = n - 11
		for i in range(a + 1):
			if s[i] == '8':
				flag3 = 1
				break
		if flag3:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	k = 0
	for j in s:
		if j == '8':
			break
		else:
			k = k + 1
	if n - k >= 11:
		print('YES')
	else:
		print('NO')


i = int(input())

def validity_check(str_len, tele_num):
	if str_len < 11:
		print('NO')
		return 0
	while len(tele_num) > 11:
		if tele_num[0] != '8':
			tele_num = tele_num[1:]
		else:
			tele_num = tele_num[:-1]
	if tele_num[0] == '8':
		print('YES')
	else:
		print('NO')
for j in range(i):
	str_len = int(input())
	tele_num = str(input())
	validity_check(str_len, tele_num)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	s = input()
	try:
		s.index('8')
		if n - s.index('8') >= 11:
			print('Yes')
		else:
			print('No')
	except:
		print('No')


def f(s):
	idx = -1
	for i in range(len(s)):
		if s[i] == '8':
			idx = i
			break
	if idx == -1:
		return 'NO'
	s = s[idx:]
	if len(s) < 11:
		return 'NO'
	return 'YES'
tc = int(input())
for _ in range(tc):
	n = int(input())
	s = input()
	print(f(s))


n = int(input())
q = []
for i in range(n):
	q.append('NO')
	m = int(input())
	a = [int(s) for s in list(input())]
	if len(a) > 10:
		for j in range(m - 10):
			if a[j] == 8:
				q[i] = 'YES'
for i in range(n):
	print(q[i])


import sys, os
f = lambda : list(map(int, input().split()))
if 'local' in os.environ:
	sys.stdin = open('./input.txt', 'r')

def solve():
	t = f()[0]
	for i in range(t):
		n = f()[0]
		s = input()
		ok = 0
		for j in range(n - 10):
			if s[j] == '8':
				ok = 1
		if ok == 1:
			print('YES')
		else:
			print('NO')
solve()


q = int(input())
for _ in range(q):
	n = int(input())
	number = input()
	if n < 11:
		print('NO')
	elif n == 1:
		if number[0] == '8':
			print('YES')
		else:
			print('NO')
	else:
		n = n - 11
		sub = number[:n + 1]
		if '8' in sub:
			print('YES')
		else:
			print('NO')


for t in range(int(input())):
	n = int(input())
	s = input()
	l = list(s)
	x = n - 11
	flag = 0
	if x < 0:
		flag = 0
	else:
		for i in range(x + 1):
			if l[i] == '8':
				flag = 1
				break
	if flag == 1:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		string = input()
		if '8' in string and n - string.index('8') >= 11:
			print('YES')
		else:
			print('NO')
main()


a = int(input())
for i in range(0, a):
	b = int(input())
	s = input()
	arr = [i for i in s]
	if len(arr) < 11:
		print('NO')
	elif '8' in arr:
		if b - arr.index('8') > 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	count = 0
	x = int(input())
	a = input()
	u = x - 11
	if u >= 0:
		for i in range(u + 1):
			if a[i] == '8':
				count = 1
	if count == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
ans = []
for i in range(n):
	lenth = int(input())
	x = lenth - 11
	s = input()
	for j in range(x):
		if s[0] == '8':
			s = s[0:1] + s[2:]
		else:
			s = s[1:]
	if s[0] == '8' and len(s) == 11:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


t = int(input())
for i in range(t):
	x = int(input())
	n = str(input())
	if x < 11:
		print('NO')
	else:
		n = n
	y = x - 11
	count = 0
	for i in range(y + 1):
		if int(n[i]) % 8 == 0:
			count += 1
		else:
			n = n
	if count >= 1:
		print('YES')
	elif count < 1 and x >= 11:
		print('NO')


n = int(input())
for _ in range(n):
	k = int(input())
	s = input()
	ind = s.find('8')
	s_ = s[ind:]
	if len(s_) >= 11 and ind != -1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	x = s.find('8')
	if x == -1 or len(s) - x < 11:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	q = int(input())
	s = input()
	x = s.find('8')
	print('YES' if x + 1 and len(s[x:]) > 10 else 'NO')


t = int(input())
inputs = [''] * t
for i in range(t):
	_ = input()
	inputs[i] = input()
for s in inputs:
	i = s.find('8')
	print('YES' if i >= 0 and len(s) - i >= 11 else 'NO')


def can_be_telephone(number):
	for i in range(len(number)):
		if number[i] == '8' and i <= len(number) - 11:
			return True
	return False
for _ in range(int(input())):
	n = input()
	number = input()
	print('YES' if can_be_telephone(number) else 'NO')


tc = int(input())
while tc > 0:
	n = int(input())
	a = input()
	if n == 11 and a[0] == '8':
		print('YES')
	else:
		flag = 0
		for i in range(n - 11 + 1):
			if a[i] == '8':
				flag = 1
		if flag == 1:
			print('YES')
		else:
			print('NO')
	tc -= 1


t = int(input())
for c in range(t):
	a = input()
	s = input()
	if '8' in s:
		r = len(s) - s.find('8')
		if r >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	t = I()
	aa = [[I(), S()] for _ in range(t)]
	r = []
	for (n, s) in aa:
		i = n
		for k in range(n):
			if s[k] == '8':
				i = k
				break
		if i + 10 < n:
			r.append('YES')
		else:
			r.append('NO')
	return '\n'.join(r)
print(main())


icin = lambda : int(input())
icinl = lambda : list(map(int, input().split()))
fcin = lambda : float(input())
fcinl = lambda : list(map(float, input().split()))
n = icin()
for _ in range(n):
	l = icin()
	s = input()
	b = 0
	for i in range(len(s)):
		if s[i] == '8' and len(s) - i >= 11:
			b = 1
			break
	if b == 1:
		print('YES\n')
	else:
		print('NO\n')


def solve(str, n):
	for i in range(0, n - 10):
		if str[i] == '8':
			print('YES')
			return
	print('NO')
for i in range(int(input())):
	n = int(input())
	str = input()
	solve(str, n)


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input())
	temp = 0
	if n >= 11:
		for i in range(n - 10, n):
			if s[i] == '8':
				temp += 1
	if n < 11 or '8' not in s or (temp > 0 and s[:n - 10].count('8') == 0):
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	x = input()
	if n < 11:
		print('NO')
	elif n == 11:
		if x[0] == '8':
			print('YES')
		else:
			print('NO')
	elif x[0] == '8':
		print('YES')
	else:
		f = 0
		for i in range(1, n - 10):
			if x[i] == '8':
				print('YES')
				f = 1
				break
		if f == 0:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	x = n
	if s.count('8'):
		x = s.index('8')
	if n - 1 - x < 10:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, list(input())))
	if n < 11 or 8 not in s:
		print('NO')
	else:
		k = s.index(8)
		if k - 0 <= n - 11:
			print('YES')
		else:
			print('NO')


import sys
q = int(sys.stdin.readline().rstrip())
for i in range(q):
	n = int(sys.stdin.readline().rstrip())
	st1 = sys.stdin.readline().rstrip()
	if n >= 11:
		x = st1.find('8')
		if n - x > 10 and x >= 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n < 11 or '8' not in s:
		print('NO')
		continue
	idx = s.index('8')
	if len(s[idx:]) >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
for i in range(t):
	input()
	n = list(input())
	if '8' in n:
		if len(n[n.index('8'):]) >= 11:
			ans.append('YES')
		else:
			ans.append('NO')
	else:
		ans.append('NO')
[print(i) for i in ans]


def f(m, k):
	if m < 11:
		return False
	elif m == 11:
		if k[0] == '8':
			return True
		else:
			return False
	elif k[0] == '8':
		kkk = k[:1] + k[2:]
		return f(m - 1, kkk)
	else:
		kkk = k[1:]
		return f(m - 1, kkk)
n = int(input())
for i in range(n):
	m = int(input())
	k = input()
	if f(m, k) == True:
		print('YES')
	else:
		print('NO')


for z in range(int(input())):
	n = int(input())
	s = input()
	if '8' in s:
		ind = s.index('8')
		if n - ind >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	st = input()
	if n < 11:
		print('NO')
		continue
	elif n == 11 and st[0] != '8':
		print('NO')
		continue
	else:
		inds = [i for i in range(n) if st[i] == '8']
		bl = False
		for i in inds:
			if i + 10 < n:
				bl = True
				break
		if bl:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	s = int(input())
	s1 = input()
	if '8' in s1[0:-10]:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(input())
	if '8' not in a:
		print('NO')
	elif '8' in a and n < 11:
		print('NO')
	elif '8' in a and n >= 11:
		if a[0] == '8':
			print('YES')
		elif a[0] != '8' and len(a[0:a.index('8')]) > n - 11:
			print('NO')
		elif a[0] != '8' and len(a[0:a.index('8')]) <= n - 11:
			print('YES')


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor
from bisect import bisect_right, bisect_left, bisect
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 9 + 7
LOGN = 30
T = 1
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	s = list(stdin.readline().strip('\n'))
	fi = -1
	for i in range(n):
		if s[i] == '8':
			fi = i
			break
	if fi == -1:
		print('NO')
		continue
	if n - fi >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	x = int(input())
	s = input()
	q = 0
	for i in range(0, x):
		if s[i] == '8':
			q = 1
			a = i + 1
			break
	if q == 1:
		s = s[a:]
		if len(s) >= 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(n, s) = (int(input()), input())
	print(['NO', 'YES'][s[:-10].count('8') and n >= 11])


t = int(input())
for k in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
		continue
	if s[:n - 10].count('8') != 0:
		print('YES')
		continue
	print('NO')


n = int(input())
ans = []
for i in range(n):
	size = int(input())
	phone = input()
	poz = phone.find('8')
	ans.append('YES') if size - poz >= 11 and poz >= 0 else ans.append('NO')
print('\n'.join(ans))


case = int(input())
for i in range(case):
	length = int(input())
	num = input().strip('\n')
	if num.find('8') == -1:
		print('NO')
	elif length - num.find('8') < 11:
		print('NO')
	else:
		print('YES')


import sys, math, queue
MOD = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = 'NO'
	for i in range(n - 10):
		if s[i] == '8':
			ans = 'YES'
			break
	print(ans)


def telephone_number(length, phone):
	start_counting = False
	counting = 0
	for number in phone:
		if number == '8':
			start_counting = True
		if start_counting:
			counting = counting + 1
	return 'NO' if counting < 11 else 'YES'
qty_inputs = int(input())
for i in range(0, qty_inputs):
	length = int(input())
	phone = input()
	print(telephone_number(length, phone))


for _ in range(int(input())):
	n = int(input())
	s = input()
	idx = -1
	for i in range(n):
		if s[i] == '8':
			idx = i
			break
	if n - idx >= 11 and idx != -1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = str(input())
	for i in range(n):
		if s[i] == '8':
			break
	else:
		print('NO')
		continue
	if i + 10 <= n - 1:
		print('YES')
	else:
		print('NO')


from collections import *
from math import *
t = int(input())
for y in range(t):
	n = int(input())
	s = input()
	ind = s.find('8')
	if n - ind >= 11 and ind != -1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	if n >= 11:
		d = s.find('8')
		if d != -1 and d <= n - 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


cases_num = int(input())
for i in range(cases_num):
	length = int(input())
	number = input()
	while True:
		if len(number) > 11:
			if number[0] == '8':
				number = number[:-1]
			else:
				number = number[1:]
		else:
			if number[0] == '8' and len(number) == 11:
				print('YES')
			else:
				print('NO')
			break


tc = int(input())
for tcc in range(0, tc):
	n = int(input())
	li = []
	string = input()
	for char in string:
		li.append(char)
	if '8' in li[:n - 10] and n >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	q = int(input())
	s = input()
	if '8' in s and len(s[s.find('8'):]) >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	o = int(input())
	s = input().rstrip()
	x = list(s)
	if '8' not in x or len(x) < 11:
		print('NO')
	else:
		f = x.index('8')
		g = x[f:len(x)]
		if len(g) >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	stri = list(input())
	try:
		c = stri.index('8')
		if n - c >= 11:
			print('YES')
		else:
			print('NO')
	except ValueError:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(input())
	if '8' in l and l.index('8') <= n - 11:
		print('YES')
	else:
		print('NO')


t = int(input())
L = 11
d = '8'
for _ in range(t):
	n = int(input())
	s = input()
	if d in s and len(s) - s.find(d) >= L:
		print('YES')
	else:
		print('NO')


for _ in [0] * int(input()):
	input()
	print('NYOE S'['8' in input()[:-10]::2])


test_case = int(input())
while test_case > 0:
	n = int(input())
	s = input()
	if n < 11:
		print('No')
	elif s.find('8') == -1:
		print('No')
	elif n - s.find('8') < 11:
		print('No')
	else:
		print('Yes')
	test_case -= 1


for t in range(int(input())):
	(n, s) = (input(), input())
	w = s.find('8')
	if w != -1 and len(s) - w > 10:
		print('YES')
	else:
		print('NO')


x = int(input())
for i in range(x):
	y = int(input())
	s = input()
	p = s.find('8')
	if p == -1:
		print('NO')
	else:
		s = s[p:]
		if len(s) >= 11:
			print('YES')
		else:
			print('NO')


tc = int(input())
for i in range(tc):
	n = int(input())
	number = input()
	if '8' in number[:-10]:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = input()
	s = input()
	n = len(s)
	pos = s.find('8')
	if pos != -1 and n - pos >= 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	if n == 11:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	elif n < 11:
		print('NO')
	else:
		try:
			x = s.index('8')
			if n - x >= 11:
				print('YES')
			else:
				print('NO')
		except ValueError:
			print('NO')


t = int(input())
for _ in range(t):
	input()
	s = input()
	try:
		pos8 = s.index('8')
	except ValueError:
		print('NO')
	else:
		print('YES' if len(s) - pos8 >= 11 else 'NO')


for _ in range(int(input())):
	n = int(input())
	num = input()
	while num[0] != '8' and len(num) > 11:
		num = num[1:]
	if num[0] == '8' and len(num) >= 11:
		print('YES')
	else:
		print('NO')


x = int(input())
y = []
for c in range(x):
	t = []
	t.append(int(input()))
	t.append(input())
	y.append(t)
for c in y:
	no = 0
	count = 0
	if c[0] - 11 == 0:
		if c[1][0] == '8':
			print('YES')
		if c[1][0] != '8':
			print('NO')
		continue
	elif c[0] < 11:
		print('NO')
		continue
	else:
		for cc in c[1]:
			if cc == '8':
				no = no + 1
				count = count + 1
			else:
				count = count + 1
			if count > len(c[1]) - 11:
				break
	if no > 0:
		print('YES')
	else:
		print('NO')


import re

def display(verdict):
	if verdict == True:
		print('YES')
	else:
		print('NO')
testCount = int(input())

def hasPattern(testString):
	result = re.search('8..........', testString)
	verdict = False
	if result is not None:
		verdict = not verdict
	return verdict
for i in range(testCount):
	(digitCount, testNumber) = (int(input()), input())
	display(hasPattern(testNumber))


def solve():
	n = int(input())
	number = [int(x) for x in input()]
	cur = 0
	while n - cur > 10:
		if number[cur] == 8:
			return 'YES'
		cur += 1
	return 'NO'
t = int(input())
for case in range(t):
	print(solve())


T = int(input())
for _ in range(T):
	n = int(input())
	print('YES' if '8' in input()[:-10] else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	res = 'NO'
	for i in range(n):
		if s[i] == '8' and n - i >= 11:
			res = 'YES'
			break
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	num = input()
	if '8' in set(num[:-10]):
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	s = input()
	flag = False
	if n < 11:
		print('NO')
	else:
		for i in range(len(s)):
			if s[i] == '8' and n - i >= 11:
				print('YES')
				flag = True
				break
		if flag == False:
			print('NO')


test = int(input())
for i in range(test):
	l = int(input())
	s = input()
	if l < 11:
		print('NO')
	elif '8' in s:
		ind = s.index('8')
		if l - ind >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())

def f(l, n):
	n = str(n)
	n = list(n)
	if n.count('8') == 0:
		print('NO')
	else:
		s = n.index('8')
		l -= s
		if l >= 11:
			print('YES')
		else:
			print('NO')
for i in range(t):
	l = int(input())
	n = str(input())
	f(l, n)


for i in range(int(input())):
	n = int(input())
	s = input()
	pos = n
	for i in range(n):
		if s[i] == '8':
			pos = i
			break
	if n - pos >= 11:
		print('YES')
	else:
		print('NO')


b = int(input())
for _ in range(b):
	a = int(input())
	s = input().find('8')
	if s >= 0 and a - s >= 11:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	numLen = int(input())
	tel = input()
	if '8' in tel and len(tel) - tel.index('8') >= 11:
		print('YES')
	else:
		print('NO')


def a(b):
	if len(b) - b.find('8') >= 11 and b.find('8') != -1:
		print('YES')
	else:
		print('NO')
for i in range(int(input())):
	d = input()
	a(input())


for _ in range(int(input())):
	n = int(input())
	s = input()
	if '8' in s:
		ind = s.index('8')
		n -= ind + 1
		if n >= 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def call():
	N = int(input())
	tel_num = input()
	if tel_num.count('8') == 0 or N < 11:
		return 'NO'
	elif N == 11 and tel_num[0] == '8':
		return 'YES'
	else:
		for i in range(0, N - 10):
			if tel_num[i] == '8':
				return 'YES'
	return 'NO'
T = int(input())
for i in range(T):
	print(call())


def if_valid(s):
	if len(s) == 11 and s[0] == '8':
		return 'YES'
	if '8' not in s:
		return 'NO'
	else:
		for (i, d) in enumerate(s):
			if d == '8':
				truncated = s[i:]
				if len(truncated) >= 11:
					return 'YES'
				else:
					return 'NO'
			else:
				pass
n_examples = int(input())
for i in range(n_examples):
	_ = input()
	print(if_valid(str(input())))


tests = int(input().strip())
for i in range(tests):
	len = int(input().strip())
	digits = input().strip()
	ans = 'NO'
	if len == 11:
		if digits[0] == '8':
			ans = 'YES'
	elif len > 11:
		for j in range(len):
			if digits[j] == '8' and len - j >= 11:
				ans = 'YES'
	print(ans)


t = int(input())
for i in range(0, t):
	n = int(input())
	s = list(input())
	if n < 10:
		print('NO')
	else:
		for j in reversed(range(0, n - 10)):
			if s[j] == '8':
				break
		else:
			print('NO')
			continue
		print('YES')


a = int(input())
for i in range(a):
	b = int(input())
	c = input()
	g = c.count('8')
	if g > 0:
		x = c.index('8')
		if b >= 11 and b - x >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for t in range(0, T):
	n = int(input())
	s = str(input())
	if n <= 10:
		print('NO')
	elif n == 11 and s[0] == '8':
		print('YES')
	elif n == 11 and s[0] != '8':
		print('NO')
	elif n > 11:
		for i in range(0, len(s) - 10):
			if s[i] == '8':
				print('YES')
				break
		else:
			print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif n == 11:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	else:
		k = n - 10
		if '8' in s[:k]:
			print('YES')
		else:
			print('NO')


def phone_number(s):
	position = -1
	for i in range(len(s)):
		if s[i] == '8':
			position = i
			break
	if position == -1:
		return 'NO'
	elif position <= len(s) - 11:
		return 'YES'
	else:
		return 'NO'
n = int(input())
a = list()
for j in range(n):
	z = int(input())
	t = input()
	a.append(t)
for elem in a:
	print(phone_number(elem))


t = int(input())
for _ in range(t):
	n = int(input())
	n1 = input()
	if n < 11:
		print('NO')
	elif n == 11 and n1[0] == '8':
		print('YES')
	else:
		flag = 0
		for i in range(n):
			if n1[i] == '8':
				flag = 1
				break
		if flag == 0:
			print('NO')
		else:
			v = n - i
			if v >= 11:
				print('YES')
			else:
				print('NO')


for _ in range(int(input())):
	n = int(input())
	if n >= 11:
		n = n - 11
	else:
		n = 0
	phone = list(map(int, [x for x in input()]))
	for i in range(n):
		if phone[0] != 8:
			del phone[:1]
			continue
		del phone[-1:]
	if len(phone) == 11 and phone[0] == 8:
		print('YES')
	else:
		print('NO')


t = int(input())
for k in range(t):
	n = int(input())
	s = input()
	flag = 0
	for i in range(0, n - 10):
		if s[i] == '8':
			flag = 1
	if flag == 1 and len(s) >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	num = input()
	ind = n - 1
	for i in range(n):
		if num[i] == '8':
			ind = i
			break
	if len(num[ind:]) >= 11:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for i in range(0, test_cases):
	l = int(input())
	tel = list(map(str, input()))
	if '8' not in tel:
		print('NO')
		continue
	tel = tel[tel.index('8'):]
	if len(tel) < 11:
		print('NO')
		continue
	print('YES')


for _ in range(int(input())):
	n = int(input())
	a = input()
	b = []
	k = 0
	t = n - 11
	if '8' in a and n > 10:
		for i in range(n):
			if i < t and a[i] == '8':
				k += 1
			if a[i] == '8':
				b.append(i)
		if t in b or k > 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


q = int(input())
for i in range(q):
	w = int(input())
	e = list(input())
	if w >= 11:
		if '8' in e:
			r = e[e.index('8'):]
			t = len(r)
			if t >= 11:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


for counter in range(int(input())):
	n = int(input())
	s = input()
	ans = 'NO'
	for i in range(n):
		if s[i] == '8' and i <= n - 11:
			ans = 'YES'
	print(ans)


def main():
	cases = int(input())
	while cases:
		n = int(input())
		s = str(input())
		check = 0
		for i in range(0, n - 10):
			if s[i] == '8':
				check = 1
				break
		if check == 1:
			print('YES')
		else:
			print('NO')
		cases = cases - 1
main()


n = int(input())
a = []
for i in range(n):
	input()
	a.append(input())
for s in a:
	pos = s.find('8')
	if pos == -1:
		print('NO')
	elif len(s) - pos < 11:
		print('NO')
	elif len(s) - pos >= 11:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n < 11 or '8' not in s:
		print('NO')
	else:
		ret = 0
		for j in range(n):
			if s[j] == '8' and n - j >= 11:
				ret = 1
		if ret == 1:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	Len = int(input())
	Str = input()
	if Len < 11 or (Len == 11 and Str[0] != '8'):
		print('NO')
	elif '8' in Str:
		x = len(Str[Str.index('8'):])
		if x >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def find(length, num):
	if length < 11:
		return 'NO'
	if '8' in num[:length - 10]:
		return 'YES'
	return 'NO'
n = int(input())
for _ in range(n):
	length = int(input())
	num = str(input())
	print(find(length, num))


t = int(input(''))
while t > 0:
	t -= 1
	a = []
	l = int(input(''))
	n = int(input(''))
	ans = 0
	if l < 11:
		print('NO')
		continue
	for i in range(l):
		d = n % 10
		a.append(d)
		n = n // 10
	for i in range(10, l):
		if a[i] == 8:
			ans = 1
	if ans == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	idx = s.find('8')
	possible = idx != -1 and n - idx >= 11
	print('YES' if possible else 'NO')


q = int(input())
for i in range(q):
	n = int(input())
	s = input()
	ans = 'NO'
	if n >= 11 and '8' in s[:n - 11 + 1]:
		ans = 'YES'
	print(ans)


n = int(input())
for i in range(n):
	l = int(input())
	nu = input()
	if l < 11:
		print('NO')
		continue
	if len(nu) >= 11 and '8' not in nu:
		print('NO')
		continue
	for i in range(l):
		if nu[0] != '8':
			nu = nu[1:]
		if nu[0] == '8' and len(nu) > 11:
			nu = nu[:-1]
		if len(nu) < 11:
			print('NO')
			break
		if len(nu) == 11 and nu[0] == '8':
			print('YES')
			break


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	try:
		ind = s.index('8')
		if ind + 11 <= n:
			print('YES')
		else:
			print('NO')
	except ValueError:
		print('NO')


t = int(input())
for o in range(t):
	n = int(input())
	s = input()
	i = 0
	while i < n:
		if s[i] != '8':
			i += 1
		else:
			break
	if len(s[i:]) > 10:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(input())
	if l.count('8') == 0:
		print('NO')
		continue
	if n - l.index('8') >= 11:
		print('YES')
	else:
		print('NO')


import re
for _ in range(int(input())):
	n = input()
	a = re.search('8[0-9]{10}', input())
	if a == None:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	string = input()
	if '8' not in string:
		print('NO')
	else:
		x = string.find('8')
		if n - x >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	try:
		if n - s.index('8') >= 11:
			print('YES')
		else:
			print('NO')
	except:
		print('NO')


test = int(input())
for i in range(0, test):
	flag = False
	ans = 'NO'
	len = int(input())
	str = input()
	for i in range(0, len):
		if flag is True:
			break
		if str[i] == '8':
			if len - i >= 11:
				flag = True
				ans = 'YES'
				break
	print(ans)


t = int(input(''))
while t >= 1:
	n = int(input(''))
	s = input('')
	a = 0
	count = 0
	for i in s:
		if i == '8' and a == 0:
			a = 1
		elif a == 1:
			count += 1
	if count >= 10:
		print('YES')
	else:
		print('NO')
	t = t - 1


x = int(input())
for __ in range(x):
	n = int(input())
	a = input()
	b = n - 11
	f = 1
	for i in range(b + 1):
		if a[i] == '8':
			print('YES')
			f = 0
			break
	if f == 1:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	m = n - 11
	if m > 0:
		for i in range(m):
			if s[0] == '8':
				s = s[:n - 2]
				n -= 1
			else:
				s = s[1:n]
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	elif m == 0:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def f(n, s):
	if len(s) < 11:
		return False
	if '8' not in s[:n - 10]:
		return False
	return True
t = int(input())
for t1 in range(t):
	n = int(input())
	s = input()
	if not f(n, s):
		print('NO')
	else:
		print('YES')


T = int(input())
for i in range(0, T):
	len = int(input())
	str = input().strip()
	print('YES' if '8' in str and str.index('8') <= len - 11 else 'NO')


for q in range(int(input())):
	n = int(input())
	s = input().strip()
	for i in range(n):
		if s[i] == '8':
			break
	if n - i >= 11 and s[i] == '8':
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	b = input()
	c = []
	for j in b:
		c.append(j)
	if '8' in c:
		j = c.index('8')
		if n - j >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


cases = int(input())
while cases > 0:
	ilength = int(input())
	intstrin = input()
	e_index = []
	count = 0
	for c in intstrin:
		if c == '8':
			e_index.append(count)
		count = count + 1
	b = 0
	for c in e_index:
		if c + 11 <= ilength:
			b = 1
			print('YES')
			break
	if b == 0:
		print('NO')
	cases = cases - 1


n = int(input())
for i in range(n):
	x = int(input())
	num = input()
	try:
		idx = num.index('8')
	except ValueError:
		idx = x
	if x - idx >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = str(input())
	if n < 11:
		print('NO')
		continue
	s1 = s[:n - 10]
	if '8' in s1:
		print('YES')
	else:
		print('NO')


num_of_numbers = int(input())
numbers = list()
for i in range(num_of_numbers):
	numbers.append((int(input()), input()))

def is_tel_number(len_s, s):
	if len_s < 11:
		return 'NO'
	first_eight = len_s
	for (index, el) in enumerate(s):
		if el == '8':
			first_eight = index
			break
	if len_s - first_eight < 11:
		return 'NO'
	return 'YES'

def solution_number(tel_nums):
	for (len_s, s) in tel_nums:
		print(is_tel_number(len_s, s))
solution_number(numbers)


T = int(input())
for i in range(T):
	N = int(input())
	s = input()
	num = N
	for j in range(N):
		if s[j] == '8':
			num = j
			break
	if N - num >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = input()
	s = input()
	if '8' in s[:-10]:
		print('Yes')
	else:
		print('No')


t = int(input())
for nt in range(t):
	n = int(input())
	num = input()
	f = num.find('8')
	if f == -1:
		print('NO')
	elif len(num[f:]) >= 11:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	stri = input()
	if n < 11:
		print('NO')
	elif '8' in stri[:-10]:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	yes = False
	for j in range(n):
		if s[j] == '8':
			if n - j >= 11:
				yes = True
				break
			else:
				break
	if yes:
		print('YES')
	else:
		print('NO')


t = int(input())
for r in range(t):
	s = int(input())
	s1 = input()
	if len(s1) < 11:
		print
	if s1.count('8') == 0:
		print('NO')
	else:
		in1 = s1.index('8')
		s2 = s1[in1:]
		if len(s2) >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	flag = 0
	n = int(input())
	number = list(map(int, input()))
	if 8 not in number:
		print('NO')
	else:
		indexValue = number.index(8)
		if n - indexValue >= 11:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	l = int(input())
	s = input()
	if l >= 11:
		if l == 11 and s[0] == '8':
			print('YES')
		elif l > 11:
			if '8' in s[0:l - 11 + 1]:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


def isValidTelephineNumber(teleLen, telephoneNumber):
	if teleLen < 11:
		return 'NO'
	pos = -1
	for i in range(0, teleLen):
		if telephoneNumber[i] == '8':
			pos = i
			break
	if pos != -1 and teleLen - (pos + 1) >= 10:
		return 'YES'
	else:
		return 'NO'

def main():
	results = []
	tc = int(input())
	for i in range(0, tc):
		teleLen = int(input())
		tele = input()
		results.append(isValidTelephineNumber(teleLen, tele))
	for i in range(0, tc):
		print(results[i])
main()


for i in range(int(input())):
	n = int(input())
	stri = input()
	if stri.find('8') >= 0:
		if n - stri.find('8') < 11:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	else:
		s = str(s)[:n - 10]
		if '8' not in s:
			print('NO')
		else:
			print('YES')


class Solution:

	def solve(self, telephone, n):
		firstEightDex = -1
		for (i, ch) in enumerate(telephone):
			if ch == '8':
				firstEightDex = i
				break
		return firstEightDex != -1 and len(telephone) - firstEightDex >= 11
sol = Solution()
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	string = input().strip()
	print('YES' if sol.solve(string, n) else 'NO')


n = int(input())
for i in range(n):
	t = int(input())
	t1 = input()
	if t < 11:
		print('NO')
	elif t == 11:
		if t1[0] == '8':
			print('YES')
		else:
			print('NO')
	elif '8' in t1:
		r = t1.index('8')
		if t - r >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	idx = -1
	for i in range(n):
		if s[i] == '8':
			idx = i
			break
	if idx == -1:
		print('NO')
	elif n - idx >= 11:
		print('YES')
	else:
		print('NO')


import re
T = int(input())
while T:
	N = int(input())
	string = input()
	ans = re.search('8..........', string)
	if ans:
		print('YES')
	else:
		print('NO')
	T -= 1


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())[:n]
	if '8' in s:
		if n - 1 - s.index('8') >= 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


a = int(input())
for i in range(0, a):
	b = int(input())
	s = input()
	for i in s:
		if i == '8':
			break
		else:
			b = b - 1
	if b < 11:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = int(input())
	s = input()
	if a < 11:
		print('NO')
		continue
	elif s.find('8') == -1:
		print('NO')
		continue
	elif len(s) - s.find('8') < 11:
		print('NO')
		continue
	else:
		print('YES')


numberOfTestCases = int(input(''))
cases = []
out = []
for i in range(numberOfTestCases):
	s = input('')
	cases.append(input(''))
for i in cases:
	if len(i) < 11:
		out.append('NO')
	else:
		for j in range(len(i) - 10):
			if i[j] == '8':
				out.append('YES')
				break
			elif j == len(i) - 11:
				out.append('NO')
				break
			else:
				continue
for i in out:
	print(i)


n = int(input())
(s, I) = ([], [])
for i in range(n):
	k = int(input())
	s.append(k)
	l = list(input())
	I.append(l)

def check_telnum(s, l):
	if s >= 11 and ('8' in l[:s - 10] or '8' == l[0]):
		return 'YES'
	else:
		return 'NO'
	if '8' not in l:
		return 'NO'
for i in range(n):
	print(check_telnum(s[i], I[i]))


t = int(input().lstrip())
for _ in range(t):
	_ = input()
	s = input().strip()
	if '8' in s and len(s) - s.index('8') >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	st = input()
	if n >= 11 and st.count('8') > 0 and (st.index('8') <= n - 11):
		print('YES')
	else:
		print('NO')


for v in range(int(input())):
	n = int(input())
	q = input()
	if '8' in q[:-10]:
		print('YES')
	else:
		print('NO')


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		st = input()
		ok = 0
		for i in range(n):
			if st[i] == '8':
				cal = n - i
				if cal >= 11:
					ok = 1
				else:
					break
		if ok:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for t in range(int(input())):
	n = int(input())
	s = input()
	if n == 11 and s[0] == '8':
		print('YES')
	elif n > 11:
		try:
			k = s.index('8')
			if len(s[k:]) >= 11:
				print('YES')
			else:
				print('NO')
		except:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	s = input()
	l = len(s)
	for j in range(0, l):
		if s[j] == '8':
			break
	if l - j >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, s, cond) = (int(input()), input(), False)
	for i in range(n):
		if s[i] == '8' and n - i > 10:
			cond = True
	if cond:
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect

def main():
	for _ in range(int(input())):
		n = int(input())
		s = input()
		ans = False
		for i in range(n):
			if s[i] == '8' and n - i >= 11:
				ans = True
				break
		if ans:
			print('YES')
		else:
			print('No')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input())
	d = n - 11
	if d == 0 and s[0] == '8':
		print('YES')
	else:
		for i in range(d):
			if s[0] != '8':
				s.pop(0)
			else:
				s.pop(-1)
		if s[0] == '8' and len(s) == 11:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	st = input()
	if '8' not in st:
		print('NO')
		continue
	else:
		d = st.find('8')
		if n - (d + 1) + 1 >= 11:
			print('YES')
		else:
			print('NO')


n = int(input())
m = []
for i in range(n):
	a = int(input())
	b = int(input())
	p = (a, b)
	m.append(p)
for i in range(n):
	c = m[i][0]
	d = str(m[i][1])
	if c < 11:
		print('NO')
	else:
		k = c - 11
		h = 0
		for i in range(k + 1):
			if d[i] == '8':
				h = h + 1
		if h == 0:
			print('NO')
		else:
			print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	str1 = input()
	k = len(str1)
	if n < 11:
		print('NO')
	else:
		for j in range(len(str1)):
			if str1[j] == '8':
				k = j
				break
		if len(str1) - k >= 11:
			print('YES')
		else:
			print('NO')


def main():
	for _ in range(int(input())):
		n = int(input())
		result = 'NO'
		x = [i for i in input()]
		l1 = []
		for i in range(n):
			if x[i] == '8':
				l1.append(i + 1)
		for i in l1:
			if i + 10 <= n:
				result = 'YES'
		print(result)
main()


for _ in range(int(input())):
	n = int(input())
	x = input()
	f = 0
	if n >= 11:
		if '8' in x:
			w = x.index('8')
			if len(x) - w >= 11:
				f = 1
	if f == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = input()
	ele = 0
	eight = False
	for i in range(n):
		if eight:
			ele += 1
		elif s[i] == '8':
			eight = True
	if ele > 9:
		print('YES')
	else:
		print('NO')


import sys
t = int(input())
for _ in range(t):
	k = int(input())
	sa = str(input())
	if sa.count('8') > 0:
		l = sa.index('8')
	else:
		print('NO')
		continue
	if k - l >= 11:
		print('YES')
	else:
		print('NO')


q = int(input())
while q:
	q -= 1
	n = int(input())
	s = input()
	flag = True
	for i in range(len(s)):
		if s[i] == '8':
			if len(s) - i >= 11:
				print('YES')
				flag = False
				break
	if flag:
		print('NO')


n = int(input())
for i in range(n):
	n1 = int(input())
	st = input()
	co = 0
	for j in st:
		if j == '8':
			co += 1
	if co != 0:
		s1 = st.index('8')
		if n1 - s1 > 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	s = input()
	print('YES' if n >= 11 and '8' in s[:-10] else 'NO')


a = int(input())
for i in range(a):
	s = int(input())
	k = input()
	try:
		if abs(k.index('8') - len(k)) > 10:
			print('YES')
		else:
			print('NO')
	except:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	s = input()
	if s[:-10].count('8') != 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input()
	if n > 11:
		diff = n - 11
		flag = 0
		for i in range(diff + 1):
			if s[i] == '8':
				print('YES')
				flag = 0
				break
			else:
				flag = 1
		if flag == 1:
			print('NO')
	elif n == 11 and s[0] != '8':
		print('NO')
	elif n == 11 and s[0] == '8':
		print('YES')
	else:
		print('NO')


n = int(input())
result = []
for i in range(n):
	a = int(input())
	b = input()
	c = b[b.find('8'):]
	if 1 <= len(b) <= 100 and len(c) >= 11:
		if b.startswith('8') and len(b) >= 11:
			result.append('YES')
		elif '8' not in b or len(b) < 11:
			result.append('NO')
		else:
			result.append('YES')
	else:
		result.append('NO')
for i in result:
	print(i)


t = int(input())
for i in range(t):
	l = int(input())
	n = input()
	if '8' in n:
		x = n.index('8')
		if x == 0 and l >= 11:
			print('YES')
		elif l - x >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


times = int(input())
m = []
m1 = []
x1 = 0
for x in range(times):
	x1 = int(input())
	m1.append(x1)
	x = input()
	m.append(x)
for i in m:
	c = i.find('8')
	if len(i) - c >= 11 and c != -1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	l = list(map(int, s))
	p = 0
	for i in range(n):
		if l[i] == 8:
			if n - i >= 11:
				p = 1
				break
	if p:
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	s = input()
	if '8' not in s:
		ans.append('NO')
	else:
		pos = s.index('8')
		if n - pos < 11:
			ans.append('NO')
		else:
			ans.append('YES')
for a in ans:
	print(a)


cases = input()
total = []
for i in range(int(cases) * 2):
	x = input()
	total.append(x)
number = list(total[1::2])
ans = []
for i in number:
	i = list(i)
	if '8' in i and len(i) - len(i[0:1 + i.index('8')]) >= 10:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


import sys
import collections
import math
import heapq
from operator import itemgetter

def getint():
	return int(input())

def getints():
	return [int(x) for x in input().split(' ')]

def solve():
	n = getint()
	s = input()
	if n < 11:
		print('NO')
	else:
		start = 0
		while start < n and s[start] != '8':
			start += 1
		if n - start >= 11:
			print('YES')
		else:
			print('NO')
t = getint()
for _ in range(t):
	solve()


p = int(input())
for i in range(p):
	a = int(input())
	s = input()
	for i in range(a):
		if s[i] == '8':
			if i <= a - 11:
				print('YES')
			else:
				print('NO')
			break
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = input()
	cnt = 0
	i = 0
	while i < len(s):
		if s[i] == '8':
			cnt += 1
		elif cnt != 0:
			cnt += 1
		i += 1
	if cnt >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	input()
	s = input()[:-10]
	print('YES' if any([i == '8' for i in s]) else 'NO')


import sys

def input():
	return sys.stdin.readline().strip()

def solve():
	n = int(input())
	num = list(map(int, list(input())))
	for i in range(n):
		if num[i] == 8 and n - i >= 11:
			return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	print(solve())


n = int(input())
for j in range(n):
	q = int(input())
	k = input()
	if q < 11:
		print('NO')
	elif q == 11 and k[0] != '8':
		print('NO')
	elif q > 11 and k[0] == '8':
		print('YES')
	else:
		pos = 0
		for i in k:
			if i == '8':
				break
			else:
				pos += 1
		if q - pos >= 11:
			print('YES')
		else:
			print('NO')


ts = int(input())
for ti in range(ts):
	n = int(input())
	s = input()
	pos = -1
	for i in range(n):
		if s[i] == '8':
			pos = i
			break
	if pos != -1 and n - pos >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	s_len = int(input())
	s = input()
	if s_len < 11:
		print('NO')
	else:
		for i in range(s_len - 10):
			if s[i] == '8':
				print('YES')
				break
		else:
			print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	s = input()
	lis = list(s)
	flag = False
	if n < 11:
		print('NO')
	else:
		rem = n - 11
		for i in range(rem + 1):
			if lis[i] == '8':
				flag = True
		if flag == True:
			print('YES')
		else:
			print('NO')


T = int(input())
for _ in range(T):
	(_, S) = (input(), input())
	if len(S) <= 10 or '8' not in S[:-10]:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	b = a.find('8')
	if b != -1 and n - b > 10:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	m = 0
	a = int(input())
	s = input()
	if a == 11 and s[0] == '8':
		print('YES')
	elif a > 11:
		for i in range(a - 10):
			if s[i] == '8':
				m = 1
				print('YES')
				break
		if m == 0:
			print('NO')
	elif a <= 11:
		print('NO')


from sys import stdin

def input():
	return stdin.readline()[:-1]
import math
MOD = 998244353
for t in range(int(input())):
	n = int(input())
	s = input()
	index = -1
	for i in range(n):
		if s[i] == '8':
			index = i
			break
	if index == -1 or index >= n - 10:
		print('NO')
	else:
		print('YES')


def solve(N, S):
	i = 0
	while i < N:
		if S[i] == '8':
			if N - i >= 11:
				print('YES')
				return
		i = i + 1
	print('NO')
T = int(input())
while T > 0:
	N = int(input())
	S = input()
	solve(N, S)
	T = T - 1


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = input()
	if '8' not in a:
		print('NO')
	else:
		j = a.index('8')
		if n - j - 1 >= 10:
			print('YES')
		else:
			print('NO')


import sys
t = int(sys.stdin.readline().strip())
for i in range(t):
	n = int(sys.stdin.readline().strip())
	s = sys.stdin.readline().strip()
	pos_8 = s.find('8')
	print('YES' if pos_8 >= 0 and n - pos_8 >= 11 else 'NO')


t = int(input())
for k in range(t):
	n = int(input())
	a = list(input())
	if '8' in a:
		indi = a.index('8')
		num = indi
		if len(a) - num >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for items in range(t):
	n = int(input())
	x = input()
	count = 0
	for i in range(n):
		count += 1
		if x[i] == '8':
			break
	if n - count >= 10:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	zostalo = n
	i = 0
	c = 1
	while True:
		if zostalo < 11:
			break
		if s[i] == '8':
			print('YES')
			c = 0
			break
		zostalo -= 1
		i += 1
	if c == 1:
		print('NO')


i = lambda : input()
for _ in [0] * int(i()):
	(_, s) = (i(), i())
	print(['NO', 'YES']['8' in s and len(s) - s.find('8') > 10])


N = int(input())
for i in range(N):
	l = int(input())
	S = input()
	if '8' in S and len(S) - S.index('8') >= 11:
		print('YES')
	else:
		print('NO')


qtd = int(input())
for _ in range(qtd):
	tam = int(input())
	number = input()
	pos = number.find('8')
	if pos != -1 and tam - pos >= 11:
		print('YES')
	else:
		print('NO')


def check(n, s):
	if n < 11:
		print('NO')
		return
	k = n - 11
	t = '8'
	if t in s[:k + 1]:
		print('YES')
		return
	else:
		print('NO')
		return
for i in range(int(input())):
	n = int(input())
	s = input()
	check(n, s)


t = int(input())
while t > 0:
	n = int(input())
	st = input()
	index = int(st.find('8', 0))
	if index != -1:
		y = int(n - index)
		if y >= 11:
			print('YES\n')
		else:
			print('NO\n')
	else:
		print('NO\n')
	t = t - 1


for _ in range(int(input())):
	input()
	num = input()
	if '8' in num and len(num) - num.find('8') >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	lenth = int(input())
	telehpone = input().strip()
	try:
		idx = telehpone[::-1][10:].index('8')
		print('YES')
	except ValueError:
		print('NO')


test = int(input())
while test:
	test -= 1
	n = int(input())
	s = list(map(int, list(input())))
	if n < 11:
		print('NO')
	elif n == 11:
		if s[0] == 8:
			print('YES')
		else:
			print('NO')
	else:
		t = n - 11
		k = 1
		for i in range(t + 1):
			if s[i] == 8:
				k = 0
				break
		if k == 0:
			print('YES')
		else:
			print('NO')


def split(integer):
	return [int for int in integer]
T = int(input())
for i in range(T):
	b = int(input())
	a = input()
	d = int(b - 11)
	c = split(a)
	if d == 0 and c[0] == '8':
		print('Yes')
	else:
		e = c[d:]
		if '8' in c[0:-10] and len(e) >= 11:
			print('YES')
		else:
			print('NO')


def is_number(num):
	if len(num) == 11 and num.startswith('8'):
		return True
	return False
n = int(input())
tests = list()
for i in range(n):
	length = int(input())
	num = str(input())
	tests.append([length, num])
for test in tests:
	length = test[0]
	number = test[1]
	how_many_digits_you_can_remove = len(number) - 11
	before_8 = number.find('8')
	if before_8 != -1:
		number = number[before_8:]
		how_many_digits_you_can_remove -= before_8
		number = number[:len(number) - how_many_digits_you_can_remove]
		if is_number(number):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def function(length, n):
	if length <= 11:
		if n[0] == '8' and length == 11:
			return 'YES'
		else:
			return 'NO'
	elif length > 11:
		count = 0
		while length + 1 - 11 > 0:
			if n[count] == '8':
				return 'YES'
			count += 1
			length -= 1
		return 'NO'
TestCase = int(input())
while TestCase > 0:
	length = int(input())
	n = input()
	print(function(length, n))
	TestCase -= 1


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	s = input()
	index = 0
	if len(s) >= 11 and '8' in s:
		for i in range(len(s)):
			if s[i] == '8':
				index = i
				break
		if len(s) - i >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
while n:
	l = input()
	l = int(l)
	num = input()
	if l >= 11:
		if '8' in num:
			ind = num.find('8')
			if l - ind >= 11:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')
	n -= 1


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	if len(s) < 11:
		print('NO')
	elif '8' in s:
		if len(s) - s.find('8') >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
	t -= 1


query = int(input())
for _ in range(query):
	n = int(input())
	s = input()
	p = n - 11
	if p >= 0:
		j = False
		for i in range(p + 1):
			if s[i] == '8':
				j = True
				break
		if j:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from sys import stdin, stdout
import sys
import math
INF = 1000000000.0

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
for _ in range(int(stdin.readline())):
	n = get_int()
	s = get_string()
	id = -1
	for i in range(n):
		if s[i] == '8':
			id = i
			break
	if id == -1:
		print('NO')
	elif id > n - 11:
		print('NO')
	elif n == 11 and id != 0:
		print('NO')
	else:
		print('YES')


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
t = ii()
for _ in range(t):
	n = ii()
	s = si()
	fl = 0
	for i in range(n):
		if s[i] == '8':
			if len(s[i:]) >= 11:
				fl = 1
	print('YNEOS'[fl == 0::2])


for i in range(int(input())):
	a = int(input())
	b = input()
	a -= 11
	r = 0
	for i in range(a + 1):
		if b[i] == '8':
			r = 1
			break
	if r == 1:
		print('yes'.upper())
	else:
		print('no'.upper())


def no():
	print('NO')

def yes():
	print('YES')

def check(s):
	for i in range(len(s) - 11):
		if s[i] == '8':
			return True
	return False
I = int(input())
for i in range(I):
	l = int(input())
	s = str(input())
	found_idx = s.find('8')
	if found_idx > -1 and l - found_idx >= 11:
		yes()
	else:
		no()


t = int(input())
while t:
	no = -1
	n = int(input())
	arr = input()
	for i in range(n):
		if arr[i] == '8':
			no = i
			break
	if no == -1:
		print('NO')
	elif n - no >= 11:
		print('YES')
	else:
		print('NO')
	t = t - 1


a = int(input())
for i in range(a):
	n = int(input())
	b = input()
	if '8' in b and len(b) >= 11 and (len(b) - 1 - b.index('8') >= 10):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	inp = input()
	pos = n
	for i in range(n):
		if inp[i] == '8':
			pos = i
			break
	if n - pos >= 11:
		print('YES')
	else:
		print('NO')


x = int(input())
for i in range(x):
	n = int(input())
	s = input()
	l = 0
	d = 0
	for i in range(n):
		if s[i] == '8':
			d = 1
			l = i
			break
	if d == 0:
		print('NO')
	elif n - l >= 11:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = int(input())
	b = input()
	if '8' in b:
		s = b.index('8')
		if abs(a - s - 1) > 9:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def func(s, n):
	if n < 11:
		print('NO')
	else:
		flag = 0
		for i in range(n):
			if s[i] == '8':
				index = i
				flag = 1
				break
		if flag == 0:
			print('NO')
		elif n - index >= 11:
			print('YES')
		else:
			print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	func(s, n)


t = int(input())
for tc in range(t):
	n = int(input())
	s = input()
	n = -1
	for c in s:
		if n >= 0:
			n += 1
		elif n == -1 and c == '8':
			n = 0
	print('YES' if n >= 10 else 'NO')


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		s = input()
		ans = False
		for j in range(n):
			if s[j] == '8':
				if n - j >= 11:
					ans = True
					break
		if ans == True:
			print('YES')
		else:
			print('NO')
main()


n = int(input())
for i in range(n):
	k = int(input())
	s = list(str(input()))
	if '8' in s:
		while s[0] != '8':
			s.remove(s[0])
		if len(s) >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


test = int(input())
for i in range(test):
	n = input()
	num = input()
	if '8' in num:
		a = num.index('8')
		if len(num[a:]) >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
e = []
for i in range(t):
	s1 = []
	n = int(input())
	s = input()
	for io in s:
		s1.append(int(io))
	o = 0
	for o in range(len(s1)):
		if s1[0] == 8 and len(s1) == 11:
			e.append(1)
			break
		elif len(s1) <= 10:
			e.append(0)
			break
		elif s1[0] == 8 and len(s1) > 11:
			s1.remove(s1[1])
		elif s1[0] != 8:
			s1.remove(s1[0])
for m in range(len(e)):
	if e[m] == 1:
		print('YES')
	elif e[m] == 0:
		print('NO')


def main():
	from sys import stdin, stdout

	def read():
		return stdin.readline().rstrip('\n')

	def read_array(sep=None, maxsplit=-1):
		return read().split(sep, maxsplit)

	def read_int():
		return int(read())

	def read_int_array(sep=None, maxsplit=-1):
		return [int(a) for a in read_array(sep, maxsplit)]

	def write(*args, **kwargs):
		sep = kwargs.get('sep', ' ')
		end = kwargs.get('end', '\n')
		stdout.write(sep.join((str(a) for a in args)) + end)

	def write_array(array, **kwargs):
		sep = kwargs.get('sep', ' ')
		end = kwargs.get('end', '\n')
		stdout.write(sep.join((str(a) for a in array)) + end)
	t = read_int()
	for _ in range(t):
		n = read_int()
		digits = read()
		for (i, ch) in enumerate(digits):
			if ch == '8':
				if len(digits[i:]) >= 11:
					write('YES')
				else:
					write('NO')
				break
		else:
			write('NO')
main()


n = int(input())
for i in range(n):
	a = int(input())
	s = input()
	if a < 11:
		print('NO')
	elif a == 11 and s[0] != '8':
		print('NO')
	elif '8' not in s:
		print('NO')
	else:
		i = s.find('8')
		s = s[i:]
		if len(s) >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
result = []
for test_case in range(t):
	n = int(input())
	string = input()
	if n < 11:
		result.append('NO')
	elif '8' in string[:n - 10]:
		result.append('YES')
	else:
		result.append('NO')
for i in result:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	no = str(input())
	found = False
	for i in range(len(no) - 10):
		if no[i] == '8':
			print('YES')
			found = True
			break
	if not found:
		print('NO')


n = int(input())
k = []
m = []
for i in range(n):
	l = int(input())
	s = input()
	k.append(s)
	m.append(l)
for p in range(n):
	count = 0
	for q in range(len(k[p])):
		count += 1
		if int(m[p]) < 11:
			print('NO')
			break
		if int(k[p][q]) == 8:
			print('YES')
			break
		if count > int(m[p]) - 11:
			print('NO')
			break


n = int(input())
for i in range(n):
	a = int(input())
	s = str(input())
	b = int(s.find('8'))
	if len(s) >= a and b <= len(s) - 11 and (not b == -1):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = str(input())
	c = 0
	if n < 11:
		print('NO')
		c = 11
	else:
		for i in range(n - 11 + 1):
			if s[i] == '8':
				print('YES')
				c = 1
				break
	if c == 0:
		print('NO')


t = int(input())
while t:
	n = int(input())
	a = list(str(input()))
	flag = 0
	if n > 11:
		cnt = n - 11
	else:
		cnt = 0
	flag2 = 0
	if cnt > 0:
		for y in range(0, cnt + 1):
			if a[y] == '8':
				flag2 = 1
	for x in a:
		if x == '8':
			flag = 1
	if n == 11 and a[0] == '8':
		print('YES')
	elif cnt == 0 or flag == 0 or flag2 == 0:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	cur = input()
	if n < 11 or '8' not in cur or cur.index('8') > n - 11:
		print('NO')
	else:
		print('YES')


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	digits = input()
	if n < 11:
		print('NO')
		continue
	for i in range(n - 11 + 1):
		if digits[i] == '8':
			print('YES')
			break
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	st = False
	for i in range(n - 1, -1, -1):
		if s[i] == '8' and n - i >= 11:
			st = True
			break
	if st:
		print('YES')
	else:
		print('NO')


t = int(input())
answers = []
for i in range(t):
	n = int(input())
	number = input()
	lenn = len(number)
	if lenn < 11:
		answers.append(False)
		continue
	if 8 not in list(map(int, str(number))):
		answers.append(False)
		continue
	pos = 0
	for i in range(lenn):
		if number[i] == '8':
			pos = i
			break
	if lenn - pos >= 11:
		answers.append(True)
		continue
	else:
		answers.append(False)
for i in answers:
	print('YES' if i else 'NO')


n = int(input())
for i in range(n):
	lenofstr = int(input())
	string = input()
	if lenofstr < 11:
		print('No')
	elif lenofstr >= 11 and string[0] == '8':
		print('Yes')
	else:
		index = string.find('8')
		if index > 0:
			newlen = lenofstr - index
			if newlen >= 11:
				print('Yes')
			else:
				print('NO')
		else:
			print('No')


import os
import sys

def log(*args, **kwargs):
	if os.environ.get('CODEFR'):
		print(*args, **kwargs)
t = int(input())

def solve(s):
	if len(s) < 11:
		return 'NO'
	for i in range(len(s) - 10):
		if s[i] == '8':
			return 'YES'
	return 'NO'
for _ in range(t):
	n = int(input())
	s = list(input())
	print(solve(s))


a = int(input())
x = int(0)
while x < a:
	b = int(input())
	c = str(input())
	if c.find('8') == -1:
		print('NO')
	elif b - c.index('8') >= 11:
		print('YES')
	else:
		print('NO')
	x = x + 1


from typing import List, Dict, Tuple

def p1151D():
	num = int(input())
	pairs = []
	for i in range(num):
		(a, b) = map(int, input().split())
		pairs.append((a, b, a - b))
	pairs.sort(key=lambda x: -x[2])
	dis = 0
	for (i, pers) in enumerate(pairs):
		dis += pers[0] * i + pers[1] * (num - i - 1)
	print(dis)

def p535A(x=None):
	score = x if x else input()
	smalls = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 15: 'fifteen', 18: 'eighteen'}
	tens = {1: 'ten', 2: 'twenty', 3: 'thirty', 4: 'forty', 5: 'fifty', 6: 'sixty', 7: 'seventy', 8: 'eighty', 9: 'ninety'}
	try:
		output = smalls[int(score)]
	except KeyError:
		if score[0] == '1':
			output = '{}teen'.format(smalls[int(score[1])])
		else:
			output = '{}-{}'.format(tens[int(score[0])], smalls[int(score[1])]) if score[1] != '0' else tens[int(score[0])]
	print(output)

def g102212B():
	(a, b) = map(int, input().split())
	i = a if a > b else b
	c = i
	while True:
		if c % (a + b - i) == 0:
			break
		c += i
	print(c)

def g102212C():
	num = int(input())
	sentences = [['{}{}ay'.format(y[1:], y[0]) for y in input().split()] for x in range(num)]
	print('\n'.join([' '.join(x).capitalize() for x in sentences]))

def g102212C2():
	print('\n'.join([' '.join(x).capitalize() for x in [['{}{}ay'.format(y[1:], y[0]) for y in input().split()] for x in range(int(input()))]]))

def pipeFunc():

	def pipe(func, *args, **kwargs):

		def decorator(inp):
			try:
				return func(inp(), *args, **kwargs)
			except TypeError:
				return func(inp, *args, **kwargs)
		return decorator

	def sum(a, b):
		return a + b

def p1169B() -> str:
	fail = False
	flatten = lambda l: [y for x in l for y in x]
	getInput = lambda : map(int, input().split())
	pair = lambda pair1, pair2: set((tuple(sorted((x, y))) for x in pair1 for y in pair2))
	(n, m) = getInput()
	if m == 1:
		bla = input()
		return 'YES'
	buffer = pair(list(getInput()), list(getInput()))
	for i in range(m - 2):
		doubles = (x[0] for x in buffer if x[0] == x[1])
		if fail:
			continue
		(a, b) = getInput()
		newVals = pair(flatten(buffer), (a, b))
		buffer = buffer.intersection(newVals)
		buffer = buffer.union(pair(doubles, (a, b)))
		if not buffer:
			fail = True
	if fail:
		return 'NO'
	return 'YES'

def p368B():

	def getUniques(n, array, buffer):
		if n == len(array):
			buffer[n] = 1
			return set([array[n - 1]])
		else:
			uniques = getUniques(n + 1, array, buffer).union(set([array[n - 1]]))
			buffer[n] = len(list(uniques))
			return uniques
	(n, m) = map(int, input().split())
	array = list(map(int, input().split()))
	gets = [int(input()) for x in range(m)]
	buffer = [0] * (n + 1)
	bl = getUniques(1, array, buffer)
	for x in gets:
		print(buffer[x])

def p368B_2():

	def getUniques(x, array, buffer):
		if x == len(array):
			uniques = [array[x - 1]]
			buffer[x] = 1
		else:
			uniques = getUniques(x + 1, array, buffer)
			if array[x - 1] not in uniques:
				uniques.append(array[x - 1])
			buffer[x] = len(uniques)
		return uniques
	(n, m) = map(int, input().split())
	array = list(map(int, input().split()))
	gets = [int(input()) for x in range(m)]
	buffer = {}
	bl = getUniques(1, array, buffer)
	for x in gets:
		print(buffer[x])

def p368B_3():
	(n, m) = map(int, input().split())
	array = list(map(int, input().split()))
	gets = [int(input()) for x in range(m)]
	print('\n'.join([str(len(list(set(array[x - 1:])))) for x in gets]))

def p1167G():
	(n, d) = map(int, input().split())
	left: List[int] = [int(x) for x in input().split()]
	m: int = int(input())
	right: List[int] = [int(x) for x in input().split()]
	bends: List[int] = [int(x) for x in input().split()]

def p1167A():
	t = int(input())
	for i in range(t):
		n = int(input())
		s: str = input()
		if n >= 11 and '8' in s[:n - 10]:
			print('YES')
		else:
			print('NO')
p1167A()


T = int(input())
for i in range(0, T):
	N = int(input())
	S = input()
	ans = 'NO'
	if N >= 11:
		for j in range(0, N - 10):
			if S[j] == '8':
				ans = 'YES'
				break
	print(ans)


T = int(input())
for x in range(0, T):
	N = int(input())
	S = str(input())
	try:
		index = S.index('8')
		l_digit = N - index
		if l_digit >= 11:
			print('YES')
		else:
			print('NO')
	except Exception as e:
		print('NO')


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	T = Scanner.int()
	for _ in range(T):
		n = Scanner.int()
		s = Scanner.string()
		if '8' in s:
			i = n - s.index('8')
			print('YNEOS'[not i >= 11::2])
		else:
			print('NO')
main()


def proccess():
	n = int(input())
	if n == 0:
		return False
	s = input()
	for i in range(n - 10):
		x = int(s[i])
		if x == 8:
			return True
	return False
t = int(input())
for i in range(t):
	if proccess():
		print('YES')
	else:
		print('NO')


n = int(input())
result = []
for i in range(n):
	length = int(input())
	data = input()
	check = 0
	for (i, s) in enumerate(data):
		if s == '8' and i + 10 < length:
			result.append(1)
			check = 1
			break
	if not check:
		result.append(0)
for i in result:
	if i:
		print('YES')
	else:
		print('NO')


n = int(input())
a = []
b = []
d = 0
c = 0
e = 0
for i in range(n):
	m = int(input())
	p = input()
	a.append(m)
	b.append(p)
for i in range(n):
	c = b[i]
	if '8' in c:
		d = c.find('8')
		e = c[d:]
		if len(e) > 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	l = n
	s = input()
	for i in range(n):
		if s[i] == '8' and l >= 11:
			r = True
			break
		else:
			l = l - 1
		if l < 11:
			r = False
			break
	if r == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = int(input())
	n = input()
	for j in range(l):
		if n[j] == '8':
			break
	x = True
	if l < 11:
		x = False
		print('NO')
	if x == True and n[j] != '8':
		print('NO')
		x = False
	if l - j < 11 and x == True:
		print('NO')
	elif x == True:
		print('YES')


n = int(input())
for i in range(n):
	len = int(input())
	num = input()
	count = 0
	for j in range(len):
		if '8' != num[j]:
			count = count + 1
		else:
			break
	if len - count >= 11:
		print('YES')
	else:
		print('NO')


def get_params():
	n = int(input())
	s = input()
	return (n, s)

def solve(n: int, s: str):
	first_eight = s.find('8')
	if first_eight == -1:
		return 'NO'
	elif n - first_eight >= 11:
		return 'YES'
	else:
		return 'NO'

def run_test_cases():
	total_test_cases = int(input())
	for _ in range(total_test_cases):
		params = get_params()
		print(solve(*params))
run_test_cases()


t = int(input())
while t:
	t -= 1
	f = 0
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif n == 11 and s[0] == '8':
		print('YES')
	elif n == 11 and s[0] != '8':
		print('NO')
	elif n > 11 and s[0] == '8':
		print('YES')
	else:
		for i in range(n - 10):
			if s[i] == '8':
				f = 1
		if f == 1:
			print('YES')
		else:
			print('NO')


cases = int(input())
for case in range(cases):
	largo = int(input())
	s = input()
	if '8' in s and s.index('8') <= largo - 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	tel = input()
	if '8' in tel[:-10]:
		print('Yes')
	else:
		print('No')


def main():
	n_test_case = int(input())
	results = [''] * n_test_case
	for i in range(n_test_case):
		n_chars = int(input())
		number = input()
		index = number.find('8')
		results[i] = 'YES' if index > -1 and n_chars - index >= 11 else 'NO'
	print('\n'.join(results))
main()


t = int(input())
for u in range(t):
	n = int(input())
	a = input()
	if n >= 11:
		if '8' in a[:-10]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def is_telephone(n, s):
	for c in s:
		if c == '8' and n >= 11:
			return True
		n -= 1
	return False

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		s = input()
		if is_telephone(n, s):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	s = str(input())
	if n == 11:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	elif n > 11:
		k = n - 11
		fg = True
		for i in range(k + 1):
			if s[i] == '8':
				print('YES')
				fg = False
				break
		if fg:
			print('NO')
	else:
		print('NO')


n_cases = int(input())
for i in range(n_cases):
	num_len = int(input())
	digits = input()
	if '8' not in digits:
		print('NO')
		continue
	else:
		first_8 = digits.index('8')
		if num_len - first_8 >= 11:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	t = int(input())
	s = input()
	c = -1
	for j in range(t):
		if s[j] == '8':
			c = j
			break
	if c == -1 or t - c < 11:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	b = int(input())
	a = input()
	if len(a) < 11:
		print('NO\n')
		continue
	if '8' in a:
		if len(a) - a.find('8') >= 11:
			print('YES\n')
			continue
		else:
			print('NO\n')
			continue
	else:
		print('NO\n')
		continue


def main():
	n = int(input())
	for i in range(n):
		c = input()
		d = input()
		p = d.find('8')
		if p != -1:
			if len(d) - p >= 11:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
main()


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
for _ in range(n):
	k = I()
	r = input().strip()
	if r.count('8') == 0:
		print('NO')
	else:
		p = r.index('8')
		if k - p >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
for u in range(t):
	n = int(input())
	s = input()
	if '8' not in s or n <= 10:
		print('NO')
	elif '8' in s[0:n - 10]:
		print('YES')
	else:
		print('NO')


a = int(input())
numbers = []
can_be = []
for i in range(a):
	k = int(input())
	b = input()
	if '8' in b:
		if k - b.index('8') >= 11:
			can_be.append('YES')
		else:
			can_be.append('NO')
	else:
		can_be.append('NO')
print(*can_be, sep='\n')


t = int(input())
while t:
	flag = False
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	else:
		for i in range(0, n - 10):
			if s[i] == '8':
				flag = True
				break
		if flag:
			print('YES')
		else:
			print('NO')
	t -= 1


n = int(input())
for i in range(n):
	a = int(input())
	s = str(input())
	x = s.find('8')
	if x >= 0:
		k = s.index('8')
		if a - k >= 11:
			print('YES')
		else:
			print('NO')
	elif x < 0:
		print('NO')


def determine_possibility(length, s):
	if length < 11:
		return 'NO'
	else:
		for i in range(length):
			if s[i] == '8' and length - i >= 11:
				return 'YES'
		return 'NO'
T = int(input())
out_ = []
for i in range(T):
	length = int(input())
	s = input()
	out = determine_possibility(length, s)
	out_.append(out)
for i in out_:
	print(i)


n = int(input())
for i in range(n):
	l = int(input())
	s = input()
	if l < 11:
		print('NO')
		continue
	a = s[:l - 10]
	flag = 0
	for j in a:
		if j == '8':
			print('YES')
			flag = 1
			break
	if flag != 1:
		print('NO')


testcase = int(input())
for _ in range(testcase):
	length = int(input())
	number = input()
	if length < 11:
		print('NO')
	else:
		step = length - 11
		pos = number.find('8')
		if pos == -1 or pos > step:
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	s = input()
	flag = 0
	for i in range(len(s) - 10):
		if s[i] == '8':
			flag = 1
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if '8' not in s or len(s) < 11:
		print('NO')
	else:
		k = s.index('8')
		if len(s) - k >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ind = s.find('8')
	if ind == -1:
		print('NO')
	elif n - ind > 10:
		print('YES')
	else:
		print('NO')


n = int(input())
len_num = [None] * n
str_num = [None] * n
for i in range(n):
	len_num[i] = int(input())
	str_num[i] = input()

def num_check(num, n):
	for i in range(n - 10):
		if num[i] == '8':
			return True
	else:
		return False
for i in range(n):
	if num_check(str_num[i], len_num[i]):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	inp = input()
	cnt = 1
	for ch in inp:
		if ch == '8':
			break
		cnt += 1
	if n - cnt + 1 >= 11:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
while t:
	t -= 1
	inp = int(input())
	s = input()
	s1 = s
	s = s[:inp - 10]
	l = list(map(lambda x: True if x == '8' else False, s))
	if inp < 11:
		print('NO')
		continue
	if l.count(True) >= 1 or s1[inp - 11] == '8':
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	s = list(s)
	if '8' in s:
		x = s.index('8')
		if n - x >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	f = input()
	if len(f) > 10 and '8' in f:
		if f[0] == '8':
			print('YES')
		elif len(f) - f.index('8') >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif n == 11:
		if s[0] == '8':
			print('YES')
		else:
			print('NO')
	else:
		for i in range(n):
			if s[i] == '8':
				count = i
				break
			count = i
		if count <= n - 11:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
n = int(input())
for i in range(n):
	k = int(input())
	s = input()
	if k < 11 or (k == 11 and s[0] != '8'):
		print('NO')
		continue
	idx = -1
	for c in range(k):
		if s[c] == '8':
			idx = c
			break
	if idx == -1 or k - 11 < idx:
		print('NO')
		continue
	print('YES')


for k in range(int(input())):
	x = int(input())
	s = input()
	flag = 0
	if x >= 11:
		for i in range(x + 1 - 11):
			if s[i] == '8':
				flag = 1
				break
		if flag:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if s.startswith('8') and len(s) >= 11:
		print('YES')
	elif '8' not in s:
		print('NO')
	elif len(s[s.index('8'):]) >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = str(input())
	for i in range(n):
		if s[i] == '8':
			h = s[i:]
			if len(h) >= 11:
				print('YES')
				break
		if i == n - 1:
			print('NO')


def solver():
	number_of_digits = int(input())
	telephone_number = input()
	if '8' not in telephone_number:
		return 'NO'
	elif len(telephone_number) < 11:
		return 'NO'
	else:
		running = True
		while running:
			if telephone_number[0] != '8':
				telephone_number = telephone_number[1:]
			else:
				running = False
		if len(telephone_number) < 11:
			return 'NO'
		else:
			return 'YES'
n = int(input())
for i in range(n):
	print(solver())


for u in range(int(input())):
	n = int(input())
	s = input()
	if '8' in s:
		x = s.index('8')
		x = s[x:]
		if len(x) >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	x = input()
	if n < 11:
		print('NO')
	elif n == 11 and x[0] == '8':
		print('YES')
	elif '8' not in x[:n - 11 + 1]:
		print('NO')
	else:
		print('YES')


n = int(input())
lstr = []
phon = []
for i in range(n):
	l = int(input())
	lstr.append(l)
	ph = input()
	phon.append(ph)

def phonum(b, tnum):
	ct = 0
	v = 0
	j = 0
	tnum.split()
	tnum = [int(val) for val in tnum]
	if not 8 in tnum:
		return False
	elif tnum[0] != 8 and b <= 11:
		return False
	elif tnum[0] == 8 and b == 11:
		return True
	else:
		while b - ct >= 11:
			if tnum[0] == 8 and b - ct == 11:
				return True
				break
			elif tnum[0] == 8 and b > 11:
				tnum.pop(-1)
				ct += 1
			elif tnum[0] != 8:
				tnum.pop(0)
				ct += 1
			else:
				pass
			j += 1
for k in range(n):
	if phonum(lstr[k], phon[k]):
		print('YES')
	else:
		print('NO')


t = int(input())
ans = [] * 2
for i in range(t):
	l = int(input())
	digit = input()
	ldiff = l - 11
	isPhoneNum = False
	if ldiff >= 0:
		for d in digit[0:ldiff + 1]:
			if d == '8':
				ans.append('YES')
				isPhoneNum = True
				break
	if not isPhoneNum:
		ans.append('NO')
for i in ans:
	print(i)


def fun(s):
	index = -1
	for i in range(n):
		if s[i] == '8':
			index = i
			break
	if index == -1:
		return 'NO'
	if n - index >= 11:
		return 'YES'
	else:
		return 'NO'
t = int(input())
while t > 0:
	n = int(input())
	s = input()
	print(fun(s))
	t -= 1


num = int(input())
i = 0
while i < num:
	digits = int(input())
	tele = input()
	if digits >= 11:
		try:
			if tele.index('8') < digits - 10:
				print('YES')
			else:
				print('NO')
		except ValueError:
			print('NO')
	else:
		print('NO')
	i += 1


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	pos = 0
	count = 0
	for i in range(n):
		if s[i] == '8':
			pos = i
			break
	if s[0] == '8' and n >= 11:
		print('YES')
		continue
	rem = n - pos
	if rem >= 11 and pos > 0:
		print('YES')
	else:
		print('NO')


q = int(input())
for _ in range(q):
	n = int(input())
	s = input()
	first = s.find('8')
	if first == -1:
		print('NO')
	elif n - first >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	string = input()
	digits = [x for x in string]
	if '8' not in digits:
		print('NO')
	elif n < 11 or n - 11 < digits.index('8'):
		print('NO')
	else:
		print('YES')


n = int(input())
d = []
for x in range(n):
	a = int(input())
	b = input()
	y = 0
	while y < len(b):
		if b[y] == '8':
			c = b.index(b[y])
			if len(b[c:]) >= 11:
				d.append('YES')
				break
			else:
				d.append('NO')
				break
		y += 1
	else:
		d.append('NO')
for x in d:
	print(x)


n = int(input())
for i in range(n):
	m = int(input())
	s = input()
	l = len(s)
	f = 0
	nn = 0
	for j in s:
		if j == '8':
			if nn + 11 <= l:
				f = 1
			break
		nn = nn + 1
	if f == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	index = 0
	while index < n:
		if s[index] == '8':
			break
		else:
			index += 1
	if n - index >= 11:
		print('Yes')
	else:
		print('No')
	t -= 1


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
t = ii()
while t:
	t -= 1
	n = ii()
	s = si()
	f = 0
	for i in range(n - 10):
		if s[i] == '8':
			f = 1
			break
	if f:
		print('YES')
	else:
		print('NO')


test = int(input())
while test > 0:
	n = int(input())
	num = input()
	while num[0] != '8':
		num = num[1:]
		if len(num) == 0:
			break
	if len(num) >= 11:
		print('YES')
	else:
		print('NO')
	test = test - 1


N = int(input())
for _ in range(N):
	l = int(input())
	num = input()
	if '8' in num:
		find8 = num.index('8')
		if l - find8 >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
data = sys.stdin.readlines()
n = int(data.pop(0))
for i in range(n):
	l = int(data[2 * i].strip())
	num = data[2 * i + 1].strip()
	if l < 11 or (l == 11 and int(num[0]) != 8):
		sys.stdout.write('NO\n')
	elif l == 11 and int(num[0]) == 8:
		sys.stdout.write('YES\n')
	else:
		found = 0
		c = l - 10
		for i in range(c):
			if int(num[i]) == 8:
				found = 1
				break
		if found:
			sys.stdout.write('YES\n')
		else:
			sys.stdout.write('NO\n')


N = int(input())
for i in range(N):
	l = int(input())
	s = input()
	if s[0] == '8' and l == 11:
		print('YES')
		continue
	elif l < 11:
		print('NO')
		continue
	else:
		p = 0
		if '8' in s[0:l - 10]:
			print('YES')
			p = 1
	if p == 0:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	num8 = s.find('8')
	if n < 11 or num8 == -1 or num8 > n - 11:
		print('NO')
		continue
	print('YES')


def tf(n, length):
	if length < 11:
		return 'NO'
	i = 0
	while length - i >= 11:
		if n[i] == '8':
			return 'YES'
		i += 1
	return 'NO'
t = int(input())
for test in range(t):
	l = int(input())
	number = list((x for x in input()))
	print(tf(number, l))


t = int(input())
for _ in range(t):
	n = int(input())
	string = input()
	pos = string.find('8')
	if pos == -1 or pos + 11 > n:
		print('NO')
	else:
		print('YES')


q = int(input())
count = 0
while count < q:
	digit = int(input())
	num = str(input())
	num_list = [int(num[i]) for i in range(len(num))]
	num_check = digit - 10
	n = -1
	if digit < 11:
		n = -1
	elif digit >= 11:
		for i in range(num_check):
			if num_list[i] == 8:
				n = 1
	if n == 1:
		print('YES')
	else:
		print('NO')
	count += 1


[[print('YES' if n >= n - input().find('8') >= 11 else 'NO') for n in [int(input())]] for _ in range(int(input()))]


def check_tel(s, n):
	if n < 11:
		return 'NO'
	elif n == 11:
		if int(s[0]) == 8:
			return 'YES'
		else:
			return 'NO'
	elif int(s[0]) == 8:
		return 'YES'
	else:
		s = s[1:n]
		a = check_tel(s, n - 1)
		return a
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	a = check_tel(s, n)
	print(a)


a = int(input())
ans = list()
for i in range(0, a):
	n = int(input())
	stri = input()
	if n > 11 and stri.count('8', 0, n - 10) > 0:
		ans = ans + ['YES']
	elif n == 11 and stri[0] == '8':
		ans = ans + ['YES']
	else:
		ans = ans + ['NO']
for i in ans:
	print(i)


for _ in range(int(input())):
	length = int(input())
	string = input().strip()
	if '8' in string:
		if len(string[string.index('8'):]) >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for i in range(0, T):
	len = int(input())
	str = input()
	found = 0
	cc = 0
	for x in str:
		if x == '8':
			found = 1
		if found:
			cc += 1
	if cc >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
i = 0
l = list()
while i < t:
	n = int(input())
	s = input()
	if n < 11:
		l.append('NO')
		i += 1
		continue
	elif s[:n - 10].count('8'):
		l.append('YES')
	else:
		l.append('NO')
	i += 1
for i in l:
	print(i)


array = []
for i in range(int(input())):
	n = int(input())
	s = input()
	stts = False
	for i in range(n):
		if n - i >= 11:
			if s[i] == '8':
				print('YES')
				break
		else:
			print('NO')
			break


for _ in range(int(input())):
	n = int(input())
	s = input()
	try:
		res = n - s.index('8') >= 11
	except:
		res = False
	print('YNEOS'[not res::2])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input()))
	if n < 11:
		print('NO')
	else:
		ind = -1
		for i in range(n):
			if a[i] == 8:
				ind = i
				break
		if n - i >= 11:
			print('YES')
		else:
			print('NO')


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	num = list(input())
	idx = -1
	for i in range(n):
		if num[i] == '8':
			idx = i
			break
	if idx == -1 or n - idx < 11:
		print('NO')
	else:
		print('YES')


t = int(input())
i = 0
B = []
eight = []

def is_tel(s, l):
	if s[0] == '8' and l == 11:
		return True
	else:
		return False

def all_eight(s, l):
	for i in range(l):
		if s[i] == '8':
			eight.append(i)
		else:
			continue

def is_poss(s, l):
	if is_tel(s, l):
		print('YES')
	elif len(eight) != 0 and l - 10 > eight[0] and (l >= 11):
		print('YES')
	else:
		print('NO')
while t > 0:
	l = int(input())
	s = input()
	eight = []
	all_eight(s, l)
	is_poss(s, l)
	t = t - 1


num = int(input())
outputs = []
for i in range(num):
	strlen = int(input())
	string = input()
	Flag = False
	for i in range(strlen):
		if string[i] == '8' and i + 11 <= strlen:
			outputs.append('YES')
			Flag = True
			break
	if Flag == False:
		outputs.append('NO')
for i in outputs:
	print(i)


n = int(input())
for _ in range(n):
	n1 = int(input())
	x = str(int(input()))
	if '8' in x:
		a = x.index('8')
		x = x[a:]
		l = len(x)
		if l >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
for s in sys.stdin.read().split()[2::2]:
	print('YES' if '8' in s[:-10] else 'NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	s = input()
	if len(s) < 11:
		print('NO')
		continue
	if s.find('8') != -1 and len(s) - s.find('8') >= 11:
		print('YES')
	else:
		print('NO')


num = int(input())
data = []
for i in range(0, num):
	l = input()
	t = str(input())
	data.append(t)
for i in range(0, num):
	for j in range(0, len(data[i])):
		if len(data[i]) >= 11:
			if data[i][0] == '8':
				print('YES')
				break
			else:
				data[i] = data[i][1:]
		else:
			print('NO')
			break


import math as mt
import sys
import bisect
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	pos = -1
	for i in range(n):
		if s[i] == '8':
			pos = i
			break
	if pos == -1 or n - pos < 11:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	input()
	s = input()
	possible = False
	for i in range(len(s)):
		if s[i] == '8' and len(s) - i >= 11:
			possible = True
			break
	if possible:
		print('YES')
	else:
		print('NO')


def gns():
	return [int(x) for x in input().split()]
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n == 0 or '8' not in s:
		print('NO')
		continue
	pos = s.index('8')
	if n - pos >= 11:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	x = int(input())
	y = input()
	if len(y) < 11:
		print('NO')
	else:
		for i in range(0, x - 10):
			if y[i] == '8':
				print('YES')
				break
		else:
			print('NO')


t = int(input())
while t > 0:
	l = int(input())
	num = list(input())
	try:
		ind = num.index('8')
		if l - ind < 11:
			print('NO')
		else:
			print('YES')
	except:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	else:
		m = n - 11 + 1
		for i in range(m):
			if s[i] == '8':
				print('YES')
				break
		else:
			print('NO')


n = int(input())
for i in range(n):
	p = 0
	c = int(input())
	s = input()
	for i in range(c):
		if s[i] == '8' and c - (i + 1) >= 10:
			p = 1
			break
	if p == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = str(input())
	x = s.find('8')
	if x >= 0 and n - x >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	x = 0
	for i in s:
		if i == '8':
			x += 1
			break
		x += 1
	if n - x >= 10:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	temp = int(input())
	s = input()
	if temp < 11:
		print('NO')
		continue
	try:
		id = s.index('8')
		if len(s[id:]) >= 11:
			print('YES')
		else:
			print('NO')
	except:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	S = str(input())
	if n > 11:
		extra = n - 11
		if '8' in S[0:extra + 1]:
			print('YES')
		else:
			print('NO')
	elif n == 11:
		if '8' == S[0]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for t in range(T):
	n = int(input())
	s = input()
	ok = 1
	idx8 = -1
	for i in range(n):
		if s[i] == '8':
			idx8 = i
			break
	ct = 0
	for i in range(idx8, n):
		ct += 1
	if idx8 != -1 and ct >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	a[:0] = input()
	if len(a) < 11 or '8' not in a:
		print('NO')
	elif len(a) - (a.index('8') + 1) >= 10:
		print('YES')
	else:
		print('NO')


x = int(0)
t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	f = int(0)
	for j in range(n):
		if s[j] == '8':
			x = int(j + 1)
			f = 1
			break
	if x + 10 <= n and f == 1:
		print('YES')
	else:
		print('NO')


num_tests = int(input())
for i in range(num_tests):
	n = int(input())
	digits = input()
	for (i, d) in enumerate(digits):
		if d == '8' and i + 10 < n:
			print('YES')
			break
		elif i + 11 > n:
			print('NO')
			break


def checkValidity(length, string):
	n = length - 11
	if n < 0:
		return 'NO'
	else:
		for i in range(0, n + 1):
			if string[i] == '8':
				return 'YES'
		return 'NO'
tests = int(input())
for t in range(tests):
	n = int(input())
	d = input()
	print(checkValidity(n, d))


t = int(input())
while t:
	t -= 1
	n = input()
	n = input().strip()
	if n.find('8') != -1:
		if len(n) - n.find('8') >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	if n == 11:
		if '8' in s[0]:
			print('YES')
		else:
			print('NO')
	elif n < 11:
		print('NO')
	elif n > 11:
		for x in range(len(s)):
			if s[x] == '8':
				break
		if s[x] == '8' and len(s[x:]) >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
while t:
	t = t - 1
	n = int(input())
	x = input()
	x = list(x)
	y = 0
	if x.count('8') != 0:
		y = x.index('8')
	if len(x) < 11:
		print('NO')
	elif x.count('8') == 0:
		print('NO')
	elif len(x[y:n]) < 11:
		print('NO')
	else:
		print('YES')


n = int(input())
for _ in range(n):
	input()
	number = input()
	if '8' in number:
		number = number[number.index('8'):]
		if len(number) > 10:
			print('YES\n')
		else:
			print('NO\n')
	else:
		print('NO\n')


for x in range(int(input())):
	n = int(input())
	a = list(input())
	flag = 0
	for y in range(n - 10):
		if a[y] == '8':
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = map(int, input())
	s = list(s)
	o = 8 in s
	if o == False or n - s.index(8) < 11:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = int(input())
	b = input()
	c = b.find('8')
	if b[0] == '8' and a == 11:
		print('YES')
	elif c == -1:
		print('NO')
	elif a - c < 11:
		print('NO')
	else:
		print('YES')


import os
import sys

class InputReader:

	def __init__(self):
		self.IN = open('cf.in') if os.path.exists('cf.in') else sys.stdin
		self.tokens = []
		self.index = 0

	def check(self):
		if self.index >= len(self.tokens):
			self.tokens = self.IN.readline().rstrip('\n').split()
			self.index = 0

	def nextToken(self):
		self.check()
		self.index += 1
		return self.tokens[self.index - 1]
reader = InputReader()

def S():
	return reader.nextToken()

def I():
	return int(S())

def F():
	return float(S())
t = I()
for tt in range(t):
	n = I()
	s = S()
	i = s.find('8')
	print('NO' if i == -1 or len(s) - i < 11 else 'YES')


def is_telephone_no(s, n):
	flag = 0
	pos = 0
	for j in range(n):
		if s[j] == '8':
			flag = 1
			pos = j
			break
	if flag:
		if pos <= n - 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
t = int(input())
for x in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
		continue
	is_telephone_no(s, n)


t = int(input())
D = []
for i in range(t):
	n = int(input())
	s = input()
	D.append((s, n))
for (s, n) in D:
	if s.rfind('8') == -1 or n < 11:
		print('NO')
	elif s.find('8') <= n - 11:
		print('YES')
	else:
		print('NO')


tc = int(input())
for i in range(tc):
	n = int(input())
	number = input()
	flag = 0
	j = 1
	for letter in number:
		if letter == '8':
			if n - j >= 10:
				print('YES')
				flag = 1
				break
		j += 1
	if flag == 0:
		print('NO')


q = int(input())
(n, s) = (0, 0)
(t, kq) = (0, 0)
for i in range(q):
	n = int(input())
	s = input()
	kq = 0
	if n < 11:
		print('NO')
	else:
		t = n - 11 + 1
		for j in range(t):
			if s[j] == '8':
				print('YES')
				kq = 1
				break
		if kq == 0:
			print('NO')


def isPhone(s):
	if '8' not in s:
		return 'NO'
	idx = s.index('8')
	phone = s[idx:]
	if len(phone) < 11:
		return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	input()
	s = input()
	print(isPhone(s))


for _ in range(int(input())):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
		continue
	if s[0] == '8' and n == 11:
		print('YES')
		continue
	rem = n - 10
	if '8' in s[:rem]:
		print('YES')
	else:
		print('NO')


t = int(input())
for I in range(t):
	n = int(input())
	s = input()
	if '8' not in s:
		print('NO')
	else:
		ind = s.find('8')
		if n - ind >= 11:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	l = int(input())
	s = str(input())
	t = 0
	while t < l:
		if s[t] == '8':
			if l - t - 1 >= 10:
				print('YES')
			else:
				print('NO')
			break
		else:
			t += 1
	if l == t:
		print('NO')


x = int(input())
lst = []
for i in range(0, x):
	x = int(input())
	y = input()
	c = y.find('8')
	d = len(y) - c
	if d < 11 or c == -1:
		lst.append('NO')
	else:
		lst.append('YES')
print(*lst, sep='\n')


q = int(input())
for i in range(q):
	input()
	s = input()
	flag = False
	for i in range(len(s) - 10):
		if s[i] == '8':
			flag = True
			print('YES')
			break
	if not flag:
		print('NO')


lines = int(input())
for i in range(0, lines):
	length = int(input())
	number = list(input())
	check = False
	for j in range(0, length - 10):
		if number[j] == '8':
			check = True
			print('YES')
			break
	if check == False:
		print('NO')


import math
t = int(input())
ans = [None] * t
for p in range(t):
	numberLength = int(input())
	number = input()
	for index in range(numberLength - 11 + 1):
		if number[index] == '8':
			ans[p] = 'YES'
for a in ans:
	if a == 'YES':
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if '8' in s:
		i = s.index('8')
		if i == 0 and n == 11:
			print('YES')
		else:
			d = n - i
			if d < 11:
				print('NO')
			else:
				print('YES')
	else:
		print('NO')


t = int(input())

def check(s, n):
	for i in range(n):
		if s[i] == '8':
			if n - i >= 11:
				print('YES')
				return
	print('NO')
for i in range(t):
	n = int(input())
	num = input()
	check(num, n)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n == 11 and s[0] == '8':
		print('YES')
		continue
	try:
		pos = s.index('8')
		if n - pos >= 11:
			print('YES')
		else:
			print('NO')
	except ValueError:
		print('NO')


q = int(input())
for i in range(q):
	n = int(input())
	s = input()
	ws = 0
	for j in range(n):
		if s[j] == '8':
			ln = n - j
			if ln >= 11:
				print('Yes')
			else:
				print('No')
			break
	else:
		print('No')


def tel(list):
	(i, z, k) = (0, True, True)
	while i < len(list) - 10 and z and k:
		if list[i] == '8':
			k = False
		else:
			i += 1
	return not k
n = int(input())
for i in range(n):
	m = int(input())
	l = list(input())
	if m < 11:
		print('NO')
	elif tel(l):
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
		continue
	flag = 0
	for i in range(10, n):
		if s[n - i - 1] == '8':
			print('YES')
			flag = 1
			break
	if flag == 0:
		print('NO')


for _ in range(int(input())):
	input()
	s = input()
	p = s.find('8')
	if p != -1 and len(s) - p >= 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = str(input())
	if '8' not in s:
		print('NO')
	elif s[0] == '8' and len(s) >= 11:
		print('YES')
	else:
		i = s.index('8')
		temp = s[i:]
		if len(temp) >= 11:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	a = input()
	count = 0
	f = 0
	for i in range(n):
		if a[i] != '8':
			count = count + 1
		else:
			f = 1
			if n - count >= 11:
				print('YES')
			else:
				print('NO')
			break
	if f == 0:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	x = input()
	if n < 11:
		print('No')
		continue
	if '8' not in x[:n - 10]:
		print('No')
		continue
	print('Yes')


for _ in range(int(input())):
	l = int(input())
	s = input()
	for i in range(len(s)):
		if l >= 11 and s[i] == '8':
			print('YES')
			break
		elif l <= 11:
			print('NO')
			break
		l -= 1


for i in range(int(input())):
	int(input())
	print(['NO', 'YES']['8' in input()[:-10]])


def seq(n, te):
	if n > 11:
		de = n - 11
		if '8' not in te[:de + 1]:
			return 'NO'
		else:
			ind_of8 = te[:de + 1].index('8')
			te = te[ind_of8:]
	n = len(te)
	if n == 11 and te[0] == '8':
		return 'YES'
	elif n == 11 and te[0] != '8':
		return 'NO'
	elif n < 11:
		return 'NO'
	else:
		resuls = '0'
		for i in range(len(te)):
			newstr = te[:i] + te[i + 1:]
			if seq(n - 1, newstr) == 'YES':
				resuls = 'YES'
				break
		if resuls == 'YES':
			return 'YES'
		return 'NO'
n_times = int(input())
for i in range(n_times):
	n = int(input())
	te = input()
	print(seq(n, te))


for ii in range(int(input())):
	n = int(input())
	string = input()
	flag = False
	for i in range(n - 10):
		if string[i] == '8':
			flag = True
			break
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	jes = False
	num = int(input())
	s = input()
	for j in range(num - 10):
		if s[j] == '8':
			jes = True
			print('YES')
			break
	if not jes:
		print('NO')


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
for k in range(n):
	gi()
	s = input()
	if '8' in s:
		print('YNEOS'[len(s[s.index('8'):]) < 11::2])
	else:
		print('NO')


def rahul(word):
	return [char for char in word]
a = int(input())
b = list()
r = 0
while r < a:
	input()
	c = rahul(input())
	if '8' in c and len(c) - c.index('8') >= 11:
		b.append('YES')
	else:
		b.append('NO')
	r = r + 1
r = 0
while r < len(b):
	print(b[r])
	r = r + 1


def solve(n, s):
	if n == 11 and s[0] == '8':
		return 'YES'
	for i in range(n):
		if s[i] == '8':
			pos = n - i
			if pos >= 11:
				return 'YES'
	return 'NO'
t = int(input())
for q in range(t):
	n = int(input())
	s = input()
	print(solve(n, s))


for t in range(int(input())):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif n == 11 and s[0] != '8':
		print('NO')
	else:
		try:
			l = list(s)
			p = l.index('8')
			n = n - p
			if n >= 11:
				print('YES')
			else:
				print('NO')
		except:
			print('NO')


n = int(input())
for i in range(n):
	ndig = int(input())
	numb = input()
	if ndig < 11:
		print('NO')
	else:
		ans = False
		for i in range(len(numb) - 11, -1, -1):
			if numb[i] == '8':
				ans = True
				break
		print('YES') if ans else print('NO')


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : [int(i) for i in inp().split()]
li0 = lambda x: [0 for i in range(x)]
stent = lambda : [i for i in inp()]
t = iinp()
for _ in range(t):
	n = iinp()
	s = inp()
	if n < 11:
		print('NO')
	elif n == 11 and s[0] != '8':
		print('NO')
	else:
		n = n - 11
		if s[0] == '8':
			print('YES')
		else:
			for i in range(n + 1):
				if s[i] == '8':
					print('YES')
					break
			else:
				print('NO')


def solve(n, s):
	i = 0
	while i < n:
		if s[i] == '8':
			break
		i += 1
	if n - i >= 11:
		return 'YES'
	else:
		return 'NO'
for _ in range(int(input())):
	print(solve(int(input()), input()))


for _ in range(int(input())):
	n = map(int, input().split())
	print('YNEOS'['8' not in input()[:-10]::2])


n = int(input())
for i in range(n):
	a = int(input())
	string = input()
	if '8' in string and a - string.index('8') >= 11:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import math
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(int(input())):
	n = int(input())
	s = input()
	if '8' not in s:
		print('NO')
	else:
		f = True
		for i in range(n):
			if s[i] == '8' and i + 10 < n:
				print('YES')
				f = False
				break
		if f:
			print('NO')


t = int(input())
i = 0
while i < t:
	n = int(input())
	s = input()
	test = 1
	j = 0
	i += 1
	while j < n:
		if s[j] == '8':
			if n - j >= 11:
				print('YES')
				test = 0
			else:
				print('NO')
				test = 0
		if test == 0:
			break
		j += 1
	if test == 1:
		print('NO')


def haseight(a):
	for i in range(len(a)):
		if a[i] == '8':
			return i
	return -1
t = int(input())
for _ in range(t):
	n = int(input())
	nmb = input()
	ep = haseight(nmb)
	if ep < 0:
		print('NO')
		continue
	if n - ep < 11:
		print('NO')
		continue
	print('YES')


T = int(input())
for i in range(T):
	j = int(input())
	s = input()[:j]
	lst1 = list(s)
	if '8' not in lst1:
		print('NO')
	else:
		c = lst1.index('8')
		if j - c >= 11 or (c == 0 and j >= 11):
			print('YES')
		else:
			print('NO')


n = int(input())
V = []
for _ in range(n):
	l = int(input())
	s = input()
	if l - s.find('8') > 10 and s.find('8') >= 0:
		V.append('Yes')
	else:
		V.append('No')
for i in range(n):
	print(V[i])


import re
n = int(input())
while n != 0:
	m = int(input())
	txt = input()
	x = re.search('8[0-9]{10}', txt)
	if x:
		print('YES')
	else:
		print('NO')
	n = n - 1


import sys
import re

def main():
	inp = sys.stdin.read().strip().split()[2::2]
	out = []
	for s in inp:
		out.append(('NO', 'YES')[bool(re.search('8\\d{10}', s))])
	return out
print(*main(), sep='\n')


import math
import re
import sys
from collections import defaultdict
from heapq import heappush, heappop
from fractions import gcd

def read(type=int):
	return type(input())

def read_list(type=int, split=' '):
	return map(type, input().split(split))

def read_list_of_list(N, type=int, split=' '):
	return [read_list(type) for _ in range(N)]

def solve():
	N = read()
	S = read(str)
	print(['NO', 'YES']['8' in S[:-10]])
T = read()
for t in range(1, T + 1):
	solve()


n = int(input())
a = []
for i in range(0, n):
	m = int(input())
	s = input()
	e = 0
	for j in range(0, m - 11 + 1):
		if s[j] == '8':
			e = 1
	if e == 0:
		a.append('NO')
	else:
		a.append('YES')
for i in range(0, len(a)):
	print(a[i])


t = int(input())
for i in range(t):
	n = int(input())
	s = [int(x) for x in list(input())]
	for i in range(n):
		if s[i] == 8 and n - i - 1 >= 10:
			print('YES')
			break
	else:
		print('NO')


a = []
for i in range(int(input())):
	n = int(input())
	s = str(input())
	if '8' in s:
		if s.index('8') < n - 10:
			a.append('YES')
		else:
			a.append('NO')
	else:
		a.append('NO')
print(*a, sep='\n')


t = int(input())
for _ in range(t):
	n = int(input())
	phone = input()
	if n > 11 and '8' in phone:
		if n - phone.index('8') >= 11:
			print('YES')
		else:
			print('NO')
	elif n == 11 and phone[0] == '8':
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(input())
	count = 0
	for j in range(n - 10):
		if s[j] == '8':
			count += 1
	if count >= 1:
		print('YES')
	else:
		print('NO')


p = int(input())
for q in range(p):
	n = int(input())
	l = list(input())
	if '8' in l and n >= 11:
		if l.index('8') <= n - 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	x = int(input())
	g = input()
	if x < 11:
		print('NO')
	else:
		g += '8'
		y = g.index('8')
		if x - 11 >= y:
			print('YES')
		else:
			print('NO')


lines = int(input())

def check(line):
	length = len(line)
	for i in range(len(line) - 10):
		if line[i] == '8':
			if length - 11 >= i:
				return 'YES'
	return 'NO'
ans = []
for i in range(lines):
	i = input()
	line = input()
	ans.append(check(line))
print('\n'.join(ans))


n = int(input())
ans = []
for i in range(n):
	length = int(input())
	s = input()
	if s.count('8') > 0:
		if s.index('8') <= length - 11:
			ans.append('Yes')
		else:
			ans.append('NO')
	else:
		ans.append('NO')
for i in ans:
	print(i)


for _ in range(int(input())):
	n = int(input())
	p = input()
	k = -1
	suc = 1
	for i in range(len(p) - 1, -1, -1):
		if p[i] == '8':
			k = i
	if k == -1:
		suc = 0
	elif n - k < 11:
		suc = 0
	if suc != 0:
		print('YES')
	else:
		print('NO')


n = int(input())
out = []
for x in range(n):
	s = int(input())
	arr = list(map(int, list(input())))
	res = arr.index(8) if 8 in arr else -1
	if s - res >= 11 and res != -1:
		out.append('YES')
	else:
		out.append('NO')
for x in out:
	print(x)


t = int(input())
for T in range(t):
	n = int(input())
	s = input()
	s1 = list(s)
	if n >= 11 and s1.count('8') != 0:
		count = 0
		for i in range(0, n - 10):
			if s1[i] == '8':
				print('YES')
				count += 1
				break
		if count == 0:
			print('NO')
	else:
		print('NO')


q = int(input())
for i in range(q):
	l = int(input())
	s = input()
	if l < 11:
		print('NO')
	else:
		a = l - 11
		flag = 0
		for i in range(a + 1):
			if s[i] == '8':
				flag = 1
				break
		if flag == 1:
			print('YES')
		else:
			print('NO')


T = int(input())
for t in range(T):
	n = int(input())
	s = input()
	for (i, val) in enumerate(s):
		if val == '8' and len(s) - i >= 11:
			print('YES')
			break
		if len(s) - i < 11:
			print('NO')
			break


t = int(input())
for j in range(t):
	n = int(input())
	s = input()
	i = 0
	while i != n - 1:
		if s[i] == '8' and len(s[:i:-1]) >= 10:
			print('YES')
			break
		else:
			pass
		i += 1
	if i >= n - 10:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	c = 0
	d = input()
	if n < 11:
		print('NO')
	else:
		for i in range(n - 10):
			if d[i] == '8':
				print('YES')
				break
			else:
				c += 1
		if c == n - 10:
			print('NO')


t = int(input())
for _ in range(t):
	x = int(input())
	n = input()
	i = 0
	while x >= 11:
		if n[i] == '8':
			print('YES')
			break
		i = i + 1
		x = x - 1
	if x < 11:
		print('NO')


for _ in range(int(input())):
	op = 'NO'
	n = int(input())
	s = input()
	if n >= 11:
		if '8' in s:
			ind = s.index('8')
			if ind <= n - 11:
				op = 'YES'
	print(op)


import sys

def main():
	for _ in range(int(input())):
		n = int(input())
		s = input()
		i = 0
		while i < n:
			if s[i] == '8':
				break
			i += 1
		if i >= n:
			print('NO')
			continue
		k = n - i
		print('YES' if k >= 11 else 'NO')
main()


b = []
a = []
c = int(input())
for i in range(c):
	b.append(int(input()))
	a.append(input())
for i in range(c):
	if '8' not in a[i]:
		print('NO')
	elif b[i] < 11:
		print('NO')
	else:
		for j in range(b[i] - 10):
			if a[i][j] == '8':
				print('YES')
				break
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	number = input()
	found = False
	for i in range(n):
		if number[i] == '8' and n - i >= 11:
			found = True
			break
	if found:
		print('YES')
	else:
		print('NO')


def CouldBePhoneNumber(s, n):
	first_8 = s.find('8')
	if first_8 < 0:
		print('NO')
		return
	if n - first_8 < 11:
		print('NO')
		return
	print('YES')
num_tests = int(input())
for test in range(num_tests):
	n = int(input())
	s = str(input())
	CouldBePhoneNumber(s, n)


t = int(input())
for _ in range(t):
	l = int(input())
	s = input()
	pos = s.find('8')
	if l - pos >= 11 and s.count('8') > 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for w in range(t):
	n = int(input())
	s = list(str(input()))
	pos8 = []
	bol = False
	for i in range(n):
		if s[i] == '8':
			pos8.append(i)
	for i in pos8:
		if n - i >= 11:
			bol = True
			break
	if bol:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	x = int(input())
	s = input()
	if s[0] == '8' and x == 11:
		print('YES')
	elif x > 11:
		p = 0
		if s[0] == '8':
			print('YES')
		else:
			for j in s:
				if j != '8':
					p += 1
				else:
					break
			if x - p >= 11:
				print('YES')
			else:
				print('NO')
	else:
		print('NO')


N = int(input())
for i in range(N):
	n = int(input())
	s = input()
	imin = -1
	for k in range(n):
		if s[k] == '8':
			imin = k
			break
	if imin >= 0 and n - 1 - imin >= 10:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	dg = int(input())
	tl = input()
	if dg >= 11 and tl.find('8') <= dg - 11 and ('8' in tl):
		print('YES')
	else:
		print('NO')


def check(l, n):
	if l >= 11 and '8' in n and (l - n.index('8') >= 11):
		return 'YES'
	return 'NO'
for x in range(int(input())):
	l = int(input())
	s = input()
	print(check(l, s))


def telephone(n, s):
	if n < 11:
		return 'NO'
	elif n == 11 and s[0] != '8':
		return 'NO'
	elif n == 11 and s[0] == '8':
		return 'YES'
	elif n > 11 and s.count('8') == 0:
		return 'NO'
	else:
		i = s.index('8')
		if n - i >= 11:
			return 'YES'
		else:
			return 'NO'
t = int(input())
n = []
s = []
for i in range(t):
	n.append(int(input()))
	s.append(input())
for i in range(t):
	print(telephone(n[i], s[i]))


for i in range(int(input())):
	n = int(input())
	s = input().strip()
	k = s.find('8')
	if k == -1:
		print('NO')
		continue
	s = s[k:]
	if len(s) >= 11:
		print('YES')
	else:
		print('NO')


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
for _ in range(int(input())):
	n = int(input())
	s = input()
	if n < 11 or (n == 11 and s[0] != '8'):
		print('NO')
	else:
		k = -1
		for x in range(n):
			if s[x] == '8':
				k = x
				break
		if k == -1:
			print('NO')
			continue
		if n - k < 11:
			print('NO')
		else:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	flag = False
	for i in range(n - 11 + 1):
		if s[i] == '8':
			print('YES')
			flag = True
			break
	if not flag:
		print('NO')


x = int(input())
YesNo = list(range(x))
for i in range(x):
	t = int(input())
	t1 = input()
	if t1.find('8') == -1:
		YesNo[i] = 'NO'
	else:
		k = t1.index('8')
		if t - k < 11:
			YesNo[i] = 'NO'
		else:
			YesNo[i] = 'YES'
for i in range(x):
	print(YesNo[i])


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	v = n - 1
	for j in range(n):
		if s[j] == '8':
			v = j
			break
	r = s[v:]
	if len(r) >= 11:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	N = int(input())
	s = input()
	if len(s) == 11 and s[0] == 8:
		print('YES')
	else:
		first_occ = -1
		for i in range(len(s)):
			if s[i] == '8':
				first_occ = i
				break
		last_occ = -1
		if len(s) - first_occ >= 11 and first_occ != -1:
			print('YES')
		else:
			print('NO')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]
for _ in range(int(input())):
	n = int(input())
	s = input()
	try:
		i8 = s.index('8')
	except:
		print('NO')
		continue
	s = s[i8:]
	if len(s) < 11:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = input()
	s = input()
	idx = s.find('8')
	if idx >= 0 and len(s) - idx >= 11:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	u = input().find('8')
	print('YNEOS'[n < u + 11 or u < 0::2])


t = int(input())
for x in range(t):
	n = int(input())
	temp = list(map(int, input().rstrip().split()))
	y = temp[0]
	if n >= 11:
		summ = 0
		h = temp
		while y != 0:
			rem = y % 10
			summ = summ * 10 + rem
			y //= 10
		u = n - 10
		for j in range(u):
			rim = summ % 10
			summ //= 10
			if rim == 8:
				print('YES')
				break
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	c = 0
	for i in range(len(s)):
		if s[i] == '8':
			a = i
			c += 1
			break
	if c == 0:
		e = '0'
	else:
		e = s[a:]
	if len(e) >= 11:
		ans = 'YES'
	else:
		ans = 'NO'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = input()
	count = 0
	if n < 11:
		print('NO')
	elif n >= 11:
		s = n - 10
		for i in range(0, s):
			if a[i] == '8':
				print('YES')
				break
			else:
				count += 1
		if count == s:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	if s.count('8') == 0:
		print('NO')
	else:
		index = s.index('8')
		if len(s[index:]) >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	a = int(input())
	s = int(input())
	c = []
	while s > 0:
		c.append(s % 10)
		s = s // 10
	flag = False
	for j in range(a):
		if c[j] == 8 and j >= 10:
			flag = True
			print('YES')
			break
	if flag == False:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	s = str(input())
	s1 = list(s)
	if s1.count('8') >= 1:
		k = s1.index('8')
		if n - 11 >= k:
			print('yes')
		else:
			print('no')
	else:
		print('no')


def solve():
	n = int(input())
	s = input()
	ind = s.find('8')
	if ind < 0:
		return False
	return n - ind >= 11
for i in range(int(input())):
	print('NYOE S'[solve()::2])


t = int(input())
for i in range(0, t):
	n = int(input())
	e = input()
	q = 0
	for w in range(0, n):
		if int(e[w]) == 8:
			break
	if n - w >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	l = int(input())
	s = input()
	if not '8' in s:
		print('NO')
	else:
		s = s[s.index('8'):]
		if len(s) >= 11:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	z = int(input())
	y = input()
	flag = False
	for j in range(z):
		if '8' == y[j] and z - j >= 11:
			flag = True
	if flag:
		print('YES')
	else:
		print('NO')


def solution(t, s):
	ans = []
	for i in range(0, t):
		flag = 'NO'
		s1 = s[i]
		le = len(s1)
		if s1[0] == '8' and le >= 11:
			flag = 'YES'
		l = le - 11
		for j in range(1, l + 1):
			if s1[j] == '8':
				flag = 'YES'
		ans.append(flag)
	return ans

def main():
	t = int(input())
	s = []
	for i in range(0, t):
		n = int(input())
		s1 = str(input())
		s1 = [s1[i:i + 1] for i in range(0, len(s1), 1)]
		s.append(s1)
	result = solution(t, s)
	for i in range(len(result)):
		print(result[i])
	return result
main()


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
for i in range(n):
	a = int(input())
	s = input()
	cur = 1
	q = 0
	while q < len(s) and s[q] != '8':
		cur += 1
		q += 1
	if q == len(s):
		print('NO')
		continue
	if len(s) - cur + 1 >= 11:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
t = int(input())
result = ['NO' for _ in range(t)]
for i in range(t):
	size = int(input())
	s = input()
	for j in range(size):
		if s[j] == '8':
			if size - (j + 1) >= 10:
				result[i] = 'YES'
print('\n'.join(result))


for cas in range(int(input())):
	n = int(input())
	s = '@' + input()
	st = s.find('8')
	print('YES' if st != -1 and n - st + 1 >= 11 else 'NO')


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
for _ in range(intIn()):
	n = intIn()
	s = stringIn()
	li = list(s)
	cnt = li.count('8')
	flag = False
	if cnt > 0:
		idx = li.index('8')
		if n - idx >= 11:
			flag = True
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	input()
	s = input()
	try:
		ans = len(s) - s.index('8') >= 11
	except ValueError:
		ans = False
	print('YES' if ans else 'NO')


def phones_numbers():
	n = int(input())
	for i in range(n):
		count = int(input())
		number = input()
		if len(number) < 11:
			print('NO')
		elif number.find('8', 0, len(number) - 10) > -1:
			print('YES')
		else:
			print('NO')
phones_numbers()


n = int(input())

def solve(n):
	result = []
	for x in range(0, n):
		t = int(input())
		s = input()
		if not '8' in s:
			result.append('NO')
		elif t >= 11:
			if s.index('8') <= t - 11:
				result.append('YES')
			else:
				result.append('NO')
		else:
			result.append('NO')
	for i in result:
		print(i)
solve(n)


t = int(input())
for p in range(t):
	n = int(input())
	pn = input()
	ind = 0
	if '8' in pn:
		ind = pn.index('8')
		if n - ind >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def is_number(s):
	return len(s[s.find('8'):]) >= 11
n = int(input())
for _ in range(n):
	input()
	print(('NO', 'YES')[is_number(input())])


for _ in range(int(input())):
	n = int(input())
	a = input()
	ans = 'NO'
	for i in range(n):
		if a[i] == '8' and n - i >= 11:
			ans = 'YES'
	print(ans)


line_count = int(input())
char_counts = []
numbers = []
for i in range(line_count):
	char_counts.append(int(input()))
	numbers.append(input())
for i in range(len(char_counts)):
	valid = False
	for j in range(len(numbers[i])):
		if int(numbers[i][j]) == 8:
			if len(numbers[i]) - j >= 11:
				valid = True
	if valid:
		print('YES')
	else:
		print('NO')


n = int(input())
ch = []
L = []
answer = ''
for i in range(2 * n):
	ch = input()
	L.append(ch)
for j in range(len(L)):
	if j % 2 == 1:
		ch2 = str(L[j])
		L1 = list(ch2)
		if '8' in ch2:
			m = L1.index('8')
			if len(ch2) - m >= 11:
				answer += 'YES' + ' '
			else:
				answer += 'NO' + ' '
		else:
			answer += 'NO' + ' '
L40 = answer.split(' ')
for k in L40:
	print(k + '\n')


n = int(input())
l1 = []
l2 = []
for i in range(n):
	l = int(input())
	s = str(input())
	l1.append(l)
	l2.append(s)
for i in range(n):
	for k in range(int(l1[i])):
		if l2[i][k] == '8' and len(str(l2[i][k:])) >= 11:
			print('YES')
			break
		elif len(str(l2[i][k:])) < 11:
			print('NO')
			break


n = int(input())
for i in range(n):
	p = int(input())
	l = list(input())
	c = 0
	for i in range(p - 11):
		if l[0] == '8':
			l.pop(11)
		elif l[0] != '8':
			l.remove(l[0])
	if int(l[0]) == 8 and len(l) == 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	flag = -1
	n = int(input())
	val = str(input())
	for j in range(n):
		if val[j] == '8' and flag == -1:
			flag = j
	if flag != -1 and n - flag >= 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = int(input())
	b = input() + '8'
	if a - b.index('8') >= 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input().strip())):
	n = int(input().strip())
	s = input().strip()
	if n < 11:
		print('NO')
		continue
	flag = False
	for i in range(n - 10):
		if s[i] == '8':
			flag = True
			print('YES')
			break
	if not flag:
		print('NO')


t = int(input())
for case in range(t):
	n = int(input())
	s = input()
	if n >= 11 and '8' in s[:-10]:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = int(input())
	b = input()
	if '8' not in b:
		print('NO')
	else:
		c = b.index('8')
		d = len(b) - c
		if d >= 11:
			print('YES')
			d = 0
		else:
			print('NO')
			d = 0


import sys

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()

def main():
	for tc in range(int(input())):
		n = int(input())
		s = list(input())
		j = 0
		for i in range(n):
			if s[i] != '8':
				j += 1
			else:
				break
		s = s[j:]
		if len(s) < 11:
			print('NO')
		else:
			print('YES')
main()


t = int(input())
res = []
for _ in range(t):
	n = int(input())
	count = 0
	s = input()
	for x in s:
		if x == '8':
			break
		else:
			count += 1
	if n - count >= 11:
		res.append('YES')
	else:
		res.append('NO')
for x in res:
	print(x)


for TT in range(1, int(input()) + 1):
	n = int(input())
	s = input()
	res = True
	if '8' not in s:
		res = False
	else:
		i = s.index('8')
		if n - i < 11:
			res = False
	print('YES' if res else 'NO')


t = int(input())
while t > 0:
	b = False
	l = int(input())
	n = input()
	if l < 11:
		print('NO')
	else:
		n = n[0:l - 10]
		for i in n:
			if i == '8':
				b = True
				break
		if b:
			print('YES')
		else:
			print('NO')
	t = t - 1


def phoneNum(length, num):
	if int(length) >= 11:
		dif = int(length) - 11
		if str(num).find('8') == -1:
			return 'NO'
		elif str(num).find('8') <= dif:
			return 'YES'
		else:
			return 'NO'
	else:
		return 'NO'
x = input()
for i in range(0, int(x)):
	print(phoneNum(input(), input()))


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	s = input()
	print(['YES', 'NO'][n - s.find('8') < 11 or s.find('8') == -1])


s = int(input())
for i in range(s):
	g = int(input())
	n = list(input())
	if g < 11:
		print('NO')
	elif g == 11:
		if n[0] == '8':
			print('YES')
		else:
			print('NO')
	elif '8' in n:
		k = n.index('8')
		l = len(n) - k
		if l >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	k = int(input())
	h = input()
	if '8' in h:
		if h.index('8') + 1 <= k - 10:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for x in range(n):
	m = int(input())
	num = input()
	pos = -1
	for y in range(0, len(num), +1):
		if num[y] == '8':
			pos = y
			break
	if pos == -1:
		print('NO')
		continue
	elif len(num) - pos >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	str = input()
	c7 = 0
	c8 = 0
	for j in str:
		if j == '8':
			c7 += 1
	for j in range(n):
		if str[j] == '8':
			c8 = j
			break
	if n < 11:
		print('NO')
	elif c7 >= 1 and n - c8 >= 11:
		print('YES')
	else:
		print('NO')


def telephone(numbers):
	for n in numbers:
		ln = int(list(n.values())[0])
		number = list(list(n.keys())[0])
		if ln < 11:
			print('NO')
		elif ln == 11 and number[0] == '8':
			print('YES')
		else:
			try:
				i = number.index('8')
				if len(number) - i >= 11:
					print('YES')
				else:
					print('NO')
			except ValueError:
				print('NO')
no_of_lines = int(input())
nums = []
for i in range(no_of_lines):
	l = dict()
	l[input()] = input()
	nums.append(l)
telephone(nums)


import heapq
import queue
from collections import *
import math
import sys

def sieve(n):
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return primes
t = int(input())
for T in range(t):
	n = int(input())
	s = str(input())
	fei = s.find('8')
	if fei < 0:
		print('NO')
	else:
		temp = n - 1 - fei
		if temp >= 10:
			print('YES')
		else:
			print('NO')


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
for _ in range(ii()):
	n = ii()
	l = si()
	if n < 11:
		print('NO')
	elif l.count('8') == 0:
		print('NO')
	elif l.count('8') > 0:
		if l.index('8') > n - 11:
			print('NO')
		else:
			s = l[l.index('8'):]
			if len(s) >= 11:
				print('YES')
			else:
				print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	n_8 = s.count('8')
	if not n_8:
		print('NO')
	elif len(s) < 11:
		print('NO')
	else:
		ind = s.find('8')
		if len(s) - ind >= 11:
			print('YES')
		else:
			print('NO')


test = int(input())
while test > 0:
	test = test - 1
	n = int(input())
	s = input()
	found = False
	for i in range(n):
		if s[i] == '8':
			if n - i - 1 >= 10:
				print('YES')
				found = True
				break
	if found == False:
		print('NO')


for _ in range(int(input())):
	n = input()
	p = input()
	for x in range(len(p)):
		if len(p) - x < 11:
			print('NO')
			break
		elif p[x] is '8':
			print('YES')
			break


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		s = input().rstrip()
		if s.find('8') > -1 and n - s.find('8') >= 11:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	n = int(input())
	str = input()
	if n >= 11:
		ar = []
		for i in range(n - 10):
			if str[i] == '8':
				ar.append(i)
		if len(ar) > 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def answer():
	n = int(input())
	while n:
		a = int(input())
		b = list(input())
		if '8' in b:
			c = b.index('8')
			if a - c >= 11:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
		n -= 1
answer()


for _ in range(int(input())):
	n = int(input())
	s = input()
	for i in range(len(s) - 10):
		if s[i] == '8':
			print('YES')
			break
	else:
		print('NO')


t = int(input())
while t:
	l = int(input())
	st = str(input())
	ind = st.find('8')
	if l - (ind + 1) >= 10 and ind != -1:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n < 8:
		print('NO')
		continue
	b = False
	for i in range(0, n - 10):
		if s[i] == '8':
			b = True
			break
	if b:
		print('YES')
	else:
		print('NO')


def main():
	x = input()
	string = list(reversed(input()))
	while string[-1] != '8' and len(string) > 11:
		string.pop()
	if len(string) >= 11 and string[-1] == '8':
		print('YES')
	else:
		print('NO')
n = int(input())
for i in range(n):
	main()


for _ in range(int(input())):
	f = 0
	n = int(input())
	s = str(input())
	l = list(s)
	if n == 11 and int(s[0]) == 8:
		print('YES')
	elif n < 11:
		print('NO')
	else:
		x = n - 11
		for i in range(x + 1):
			if int(s[i]) == 8:
				f = 1
				break
		if f == 1:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	l = int(input())
	s = input()
	if len(s) == l:
		rs = s.find('8')
		try:
			if rs != -1:
				if s[rs + 10] != '':
					print('YES')
			else:
				print('NO')
		except:
			print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	S = input()
	eight = S.count('8')
	if eight >= 1:
		flg = False
		for i in range(N):
			s = S[i]
			if s == '8' and N - (i + 1) >= 10:
				flg = True
				print('YES')
				break
		if not flg:
			print('NO')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	a = int(input())
	b = input()
	if a >= 11 and b.find('8') > -1 and (len(b[b.find('8'):]) >= 11):
		c = 'YES'
	else:
		c = 'NO'
	print(c)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if len(s) < 11:
		print('NO')
	elif len(s) == 11 and s[0] != '8':
		print('NO')
	else:
		i = 0
		t = 0
		for i in range(len(s)):
			if s[i] == '8' and len(s) - i >= 11:
				t = 1
				break
		if t == 1:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(str(input()))
	find = False
	for m in range(n - 10):
		if s[m] == '8':
			print('YES')
			find = True
			break
	if not find:
		print('NO')


n = int(input())
for i in range(n):
	l = int(input())
	s = input()
	p = s.find('8')
	if p != -1 and l - p >= 11:
		print('YES')
	else:
		print('NO')


q = int(input())
while q > 0:
	q -= 1
	n = int(input())
	s = str(input())
	if n < 11:
		print('NO')
		continue
	cnt = 0
	for c in s:
		if c != '8':
			cnt += 1
		else:
			break
	if n - cnt >= 11:
		print('YES')
	else:
		print('NO')


try:

	def solve():
		n = int(input())
		s = input()
		if n < 11:
			print('NO')
		elif n == 11:
			if s[0] == '8':
				print('YES')
			else:
				print('NO')
		else:
			c = 0
			for j in s:
				c += 1
				if len(s) - c < 10:
					print('NO')
					break
				if j == '8' and len(s) - c >= 10:
					print('YES')
					break
	t = int(input())
	for _ in range(t):
		solve()
except:
	pass


T = int(input().strip())
mod = 1000000007
for t in range(T):
	n = int(input().strip())
	s = input().strip()
	ans = False
	for i in range(n):
		if s[i] == '8':
			if n - i >= 11:
				ans = True
			break
	if ans:
		print('YES')
	else:
		print('NO')


count = int(input())
while count != 0:
	length = int(input())
	string = input()
	for i in range(0, length):
		if string[i] == '8':
			break
	k = length - i
	if k >= 11:
		print('YES')
	else:
		print('NO')
	count -= 1


queries = int(input())
for i in range(queries):
	n = int(input())
	nums = input()
	if len(nums) < 11:
		print('NO')
	else:
		tmp = nums[:n - 10]
		if '8' in tmp:
			print('YES')
		else:
			print('NO')


t = int(input())
for el in range(t):
	n = int(input())
	s = input()
	if '8' in s[:-10]:
		print('YES')
		continue
	else:
		print('NO')


def solve():
	for _ in range(int(input())):
		n = int(input())
		s = input()
		ans = 'NO'
		for i in range(n):
			if s[i] == '8':
				if n - i >= 11:
					ans = 'YES'
				break
		print(ans)
solve()


for i in range(int(input())):
	n = int(input())
	li = input()
	li = list(li)
	if n >= 11:
		flag = 1
		for i in range(0, n - 10):
			if li[i] == '8':
				print('YES')
				flag = 0
				break
		if flag:
			print('NO')
	else:
		print('NO')


def A():
	t = int(input())
	for i in range(t):
		n = int(input())
		line = input()
		if len(line) < 11:
			print('NO')
		else:
			flag = False
			for j in range(10, len(line)):
				if line[len(line) - j - 1] == '8':
					flag = True
					break
			if flag:
				print('YES')
			else:
				print('NO')
A()


y = int(input())
for i in range(y):
	n = int(input())
	s = input()
	if s[0] == '8' and len(s) == 11:
		print('YES')
	else:
		c = 0
		for j in range(len(s)):
			if s[j] == '8':
				break
			else:
				c += 1
		if len(s) - c >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = input()
	L = [i for i in s]
	if '8' not in L:
		print('NO')
	elif n - L.index('8') >= 11:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	l = [int(x) for x in input()]
	if 8 in l and len(l) - l.index(8) >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	x = input()
	res = '8'
	if n < 11:
		print('NO')
	else:
		p = -1
		for i in range(n):
			if res[0] == x[i]:
				p = i
				break
		res = x[i:]
		if len(res) >= 11:
			print('YES')
		else:
			print('NO')


otv = []
t = int(input())
for i in range(t):
	n = int(input())
	a = list(input())
	if '8' in a:
		k = a.index('8')
		if n - k >= 11:
			otv.append('YES')
		else:
			otv.append('NO')
	else:
		otv.append('NO')
for elem in otv:
	print(elem)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	ind = -1
	l = len(s)
	for j in range(l):
		if s[j] == '8':
			ind = j
			break
	if ind == -1 or l - (ind + 1) < 10:
		print('NO')
	else:
		print('YES')


x = int(input())
count = 0
ans = []
while count < x:
	n = int(input())
	s = input()
	if s[0] == '8' and int(n) >= 11:
		ans.append('YES')
	elif n <= 11:
		ans.append('NO')
	else:
		pos = ''
		for y in range(n):
			if s[y] == '8':
				pos = y
				break
		if pos == '':
			ans.append('NO')
		elif int(n) - pos >= 11:
			ans.append('YES')
		else:
			ans.append('NO')
	count += 1
for y in ans:
	print(y)


def solve():
	n = int(input())
	s = input()
	s = list(s)
	s = [int(x) for x in s]
	if len(s) < 11:
		print('NO')
	elif 8 in s[:-10]:
		print('YES')
	else:
		print('NO')
test_case = int(input())
for x in range(test_case):
	solve()


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L

	def isprime(self, n):
		if n == 1 or n == 0:
			return False
		for i in range(2, int(n ** 0.5 + 1)):
			if n % i == 0:
				return False
		return True

	def factors(self, n):
		from functools import reduce
		return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

	def nthprime(self, n):
		i = 0
		s = 2
		L = []
		while i < n:
			while not self.isprime(s):
				s += 1
			L.append(s)
			s += 1
			i += 1
		return L

	def matrixin(self, m, n, t=int):
		L = []
		for i in range(m):
			p = self.clist(n, t)
			L.append(p)
		return L

	def seive(self, k):
		n = k + 1
		L = [True] * n
		L[1] = False
		L[0] = False
		for i in range(2, n):
			if L[i] == True:
				for j in range(2 * i, n, i):
					L[j] = False
		return L

	def seiven(self, n, L):
		i = 0
		for j in range(len(L)):
			if L[j] == True:
				i += 1
			if i == n:
				return j

	def matrixin2(self, m, t=int):
		L = []
		for i in range(m):
			iny = self.cin(str)
			lsmall = []
			for el in iny:
				lsmall.append(t(el))
			L.append(lsmall)
		return L
c = cinn()
q = c.cin()
for i in range(q):
	l = c.cin()
	s = c.cin(str)
	left = 0
	for el in range(len(s)):
		nowie = s[el]
		if nowie == '8':
			left = len(s) - el
			break
	if left >= 11:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = int(input())
	if n >= 11 and '8' in str(s)[:n - 11 + 1]:
		print('YES')
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	s = input()
	a = s.find('8')
	if n - a > 10 and a != -1:
		print('YES')
	else:
		print('NO')


n = int(input())
out = []
for x in range(n):
	s = int(input())
	arr = list(map(int, list(input())))
	(st, res) = (False, 0)
	for i in range(s):
		if arr[i] == 8:
			res = i
			st = True
			break
	if s - res >= 11 and st:
		out.append('YES')
	else:
		out.append('NO')
for x in out:
	print(x)


import sys
from math import ceil, gcd
from collections import deque
for _ in range(int(input())):
	n = int(input())
	s = input()
	j = 0
	while s[j] != '8' and j < n - 1:
		j += 1
	if n - j > 10:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if '8' not in s or n < 11:
		print('NO')
	elif n - s.find('8') >= 11:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	size = int(input())
	if size < 11:
		print('NO')
		input()
		continue
	r = input()
	if '8' not in r:
		print('NO')
		continue
	if len(r) - r.index('8') >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
		continue
	for j in range(n):
		if s[j] == '8':
			if n - j - 1 >= 10:
				print('YES')
			else:
				print('NO')
			break
		elif j == n - 1:
			print('NO')


num = int(input())
for i in range(num):
	l = int(input())
	s = input()
	if '8' in s:
		res = s.index('8')
		if l - res >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
kett = []
for i in range(t):
	n = int(input())
	s = input()
	for i in range(len(s)):
		if len(s) < 11:
			ket = 'NO'
			break
		elif '8' not in s:
			ket = 'NO'
			break
		elif len(s) == 11 and s[0] == '8':
			ket = 'YES'
			break
		elif len(s) >= 11:
			if s[0] == '8':
				ket = 'YES'
				break
			elif s[i] == '8':
				cek = len(s) - 11
				if i <= cek:
					ket = 'YES'
					break
				else:
					ket = 'NO'
					break
				break
	kett += [ket]
for i in kett:
	print(i)


for t in range(int(input())):
	n = int(input())
	s = input()
	k = n - 10
	e = 0
	if k < 1:
		print('NO')
	else:
		for i in range(k):
			if s[i] == '8':
				e += 1
		if e != 0:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	num = list(input())
	if '8' not in num or n < 11:
		print('NO')
		continue
	i = num.index('8')
	if i + 11 <= n:
		print('YES')
	else:
		print('NO')


for x in range(int(input())):
	lon = int(input())
	inp = list(map(int, input()))
	num = False
	if lon == 11:
		if inp[0] == 8:
			print('Yes')
		else:
			print('No')
	elif lon > 11:
		for y in range(lon - 10):
			if inp[y] == 8:
				print('Yes')
				num = True
				break
		if num == False:
			print('No')
	elif lon < 11:
		print('No')


tries = int(input())
for i in range(0, tries):
	n = int(input())
	tocheck = input()
	try:
		assert n >= 11 and tocheck[0:n - 10].find('8') != -1
		print('YES')
	except:
		print('NO')


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
DIRECTIONS = [[0, 1], [0, -1], [1, 0], [1, -1]]
NEIGHBOURS = [(i, j) for i in range(-1, 2) for j in range(-1, 2) if i != 0 or j != 0]
OrdUnicode_a = ord('a')
OrdUnicode_A = ord('A')
CAPS_ALPHABETS = {chr(i + OrdUnicode_A): i for i in range(26)}
SMOL_ALPHABETS = {chr(i + OrdUnicode_a): i for i in range(26)}
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0) + 1
INFINITY = float('inf')

def find(li):
	try:
		return li.index('8')
	except:
		return len(li)
for _testcases_ in range(int(input())):
	n = int(input())
	s = input()
	print('YES' if n - find(s) > 10 else 'NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	flag = False
	if n < 11:
		flag = False
	else:
		if s[-11] == '8':
			flag = True
		for i in range(0, n - 10):
			if s[i] == '8':
				flag = True
	if flag:
		print('YES')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	string = input()
	s_len = len(string)
	count8 = string.count('8')
	if count8 == 0:
		print('NO')
	elif s_len < 11:
		print('NO')
	elif count8 > 0 and s_len >= 11:
		index8 = string.index('8')
		if s_len - index8 >= 11:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	l = input()
	print('YES' if '8' in l[:n - 11 + 1] and n >= 11 or (n == 11 and l[0] == '8') else 'NO')


def gdd(s, n):
	s = s[::-1]
	for i in range(10, n, 1):
		if s[i] == '8':
			return True
	return False
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
		continue
	gg = gdd(s, n)
	if gg == True:
		print('YES')
	else:
		print('NO')


def phone(m, s):
	s = list(s)
	if m == 11 and s[0] == '8':
		return 'YES'
	elif m == 11 and s[0] != '8':
		return 'NO'
	else:
		k = m - 11
		for i in range(k + 1):
			if s[i] == '8':
				return 'YES'
		return 'NO'
n = int(input())
for i in range(n):
	m = int(input())
	s = str(input())
	print(phone(m, s))


n = int(input())
for i in range(n):
	x = int(input())
	s = input()
	done = False
	for j in range(x - 10):
		if s[j] == '8':
			done = True
			break
	if done:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	leni = int(input())
	tel = input()
	if '8' in tel:
		if leni - tel.find('8') >= 11:
			passou = True
		else:
			passou = False
	else:
		passou = False
	if passou:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if not '8' in s:
		print('No\n')
		continue
	i = s.index('8')
	if n - i >= 11:
		print('Yes\n')
	else:
		print('No\n')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	i = s.find('8')
	if i < 0 or n - (i + 1) < 10:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = int(input())
	string = input()
	new = ''
	for j in range(len(string)):
		if string[j] != '8':
			new += string[j]
		else:
			break
	if len(string) - len(new) >= 11:
		print('YES')
	else:
		print('NO')


import sys
import math
import collections
from pprint import pprint as pp
mod = 1000000007
t = int(input())
for i in range(t):
	(n, s) = (int(input()), input())
	if n < 11:
		print('NO')
		continue
	elif '8' in s[:n - 10]:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = input()
		(flag, pos) = (False, 0)
		for i in range(len(s)):
			if s[i] == '8':
				pos = i
				flag = True
				break
		if flag == False:
			print('NO')
		elif n - pos >= 11:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	possible = True
	eight_index = s.find('8')
	if eight_index == -1:
		possible = False
	else:
		substring_length = n - eight_index
		if not substring_length >= 11:
			possible = False
	print('YES' if possible else 'NO')
	t -= 1


t = int(input())
for i in range(0, t):
	l = int(input())
	s = input()
	if l < 11:
		print('NO')
		continue
	myEight = s.find('8')
	if myEight == -1:
		print('NO')
	elif l - myEight >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input().strip())
	if '8' in s:
		idx = s.index('8')
		if idx <= n - 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
while n:
	m = int(input())
	s = input()
	s = s[::-1]
	j = 0
	for i in range(0, m):
		if s[i] == '8':
			j = i
	if j >= 10:
		print('YES')
	else:
		print('NO')
	n -= 1


n = int(input())
hasil = False
for i in range(n):
	hasil = False
	k = int(input())
	digit = input()
	if k >= 11 and digit[0] == '8':
		hasil = True
	elif k == 11 and digit[0] != '8':
		hasil = False
	elif k > 11 and digit[0] != '8' and ('8' in digit):
		for j in digit:
			if j != '8':
				digit = digit.replace(j, '', 1)
				k -= 1
			if digit[0] == '8':
				hasil = True
				break
			elif k == 11 and digit[0] != '8':
				hasil = False
				break
	if hasil == True:
		print('YES')
	else:
		print('NO')


t = int(input())
output = []
for _ in range(t):
	n = int(input())
	s = input()
	p = s.find('8')
	ans = 'YES' if p >= 0 and p + 10 < n else 'NO'
	output.append(ans)
print('\n'.join(output))


def ans(s, k):
	for i in range(0, len(s), 1):
		if s[i] == '8':
			if k - i >= 11:
				return 'YES'
	return 'NO'
t = int(input())
for i in range(1, t + 1, 1):
	a = int(input())
	s = str(input())
	print(ans(s, a))


n = int(input())
for i in range(n):
	l = int(input())
	a = str(input())
	f = 0
	for j in range(l - 10):
		if a[j] == '8':
			f = 1
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	input()
	a = input()
	if '8' not in a:
		print('NO')
	elif len(a) - a.find('8') - 1 < 10:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	num = input()
	have = False
	n = n - 10
	for i in range(n):
		if num[i] == '8':
			have = True
			break
	if have:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	if '8' not in s or n < 11:
		print('NO')
	else:
		ind = s.index('8')
		if n - ind >= 11:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	l = len(s)
	f = s.find('8')
	if f == -1:
		print('NO')
	elif l - f >= 11:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	t = int(input())
	tel = input()
	pode = False
	if t >= 11:
		for j in range(t - 10):
			if tel[j] == '8':
				pode = True
				break
	if pode:
		print('YES')
	else:
		print('NO')


for j in range(int(input())):
	n = int(input())
	s = input()
	if '8' not in s:
		print('NO')
	else:
		d = s.find('8')
		if n - d >= 11:
			print('YES')
		else:
			print('NO')


n = int(input())
for x in range(n):
	ja = int(input())
	a = input()
	kam = a.count('8')
	if kam == 0:
		print('NO')
	else:
		jam = a.index('8')
		if len(a[jam:]) >= 11:
			print('YES')
		else:
			print('NO')


x = int(input())
for _ in range(x):
	a = int(input())
	tel = input()
	c = list(tel)
	p = len(c)
	if p == 11 and '8' not in c:
		print('NO')
	elif p >= 11 and '8' in c:
		re = p % 11
		if c.index('8') <= p - 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
hay8 = 0
for i in range(t):
	hay8 = 0
	n = int(input())
	numeros = input()
	if n < 11 or (n == 11 and numeros[0] != '8'):
		print('NO')
	elif n == 11 and numeros[0] == '8':
		print('YES')
	else:
		for j in range(n):
			if numeros[j] == '8':
				hay8 = 1
				if n - j >= 11:
					print('YES')
				else:
					print('NO')
				break
		if hay8 == 0:
			print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	S = input()
	try:
		first8 = S.index('8')
		if N - first8 >= 11:
			print('YES')
		else:
			print('NO')
	except:
		print('NO')


for i in range(int(input())):
	t = int(input())
	s = input()
	if t >= 11:
		print('YES' if s[0:t - 10].count('8') else 'NO')
	else:
		print('NO')


number = int(input())
for i in range(number):
	lng = int(input())
	s = str(input())
	if lng < 11:
		print('NO')
	elif '8' in s[-11::-1]:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	s = input()
	first8 = s.find('8')
	if first8 == -1 or n - first8 < 11:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	x = input()
	c = 0
	for j in range(len(x)):
		if x[j] == '8':
			c = j + 1
			break
	if n < 11:
		print('NO')
	elif c == 1:
		print('YES')
	elif n - c >= 10 and c > 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	l = int(input())
	l1 = str(l)
	if '8' in l1 and len(l1) - l1.index('8') >= 11:
		print('YES')
	else:
		print('NO')


from sys import stdin

def main():
	T = int(input())
	NS = [[input() for _ in [0] * 2] for _ in [0] * T]
	for (_, s) in NS:
		ans = 0
		for (i, si) in enumerate(s[::-1], start=1):
			if si == '8':
				ans = i
		if ans >= 11:
			print('YES')
		else:
			print('NO')
input = lambda : stdin.readline().rstrip()
main()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = input()
	ok = False
	for i in range(n):
		if s[i] == '8':
			if n - i >= 11:
				ok = True
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	string = input()
	j = n
	flag = 0
	while j >= 11:
		if string[n - j] == '8':
			flag = 1
			break
		j = j - 1
	if flag == 1:
		print('YES')
	else:
		print('NO')


q = int(input())
for i in range(q):
	n = int(input())
	string = input()
	counter = 0
	for i in string:
		if i == '8':
			break
		counter += 1
	if counter > n - 11:
		print('NO')
	else:
		print('YES')


n = int(input())
output = []
for counting in range(0, n):
	lenth = int(input())
	string = list(input())
	while len(string) > 11:
		if string[0] != '8':
			string.remove(string[0])
		else:
			break
	if string[0] == '8' and len(string) >= 11:
		output.append('YES')
	else:
		output.append('NO')
for each in output:
	print(each)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	s = input()
	if n < 11:
		ans.append('NO')
	elif '8' in s[:-10]:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


for _ in range(int(input())):
	l = int(input())
	s = list(input())
	try:
		e = s.index('8')
	except ValueError:
		e = l
	print('YES' if l - e >= 11 else 'NO')


for io in range(int(input())):
	n = int(input())
	a = input()
	if a.count('8') > 0 and a.index('8') <= n - 11:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	strng = input().strip()
	if n < 11:
		print('NO')
	elif '8' in strng[:n - 10]:
		print('YES')
	else:
		print('NO')


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = self.next_line()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_line(self):
		return sys.stdin.readline().split()

	def next_ints(self):
		return [int(x) for x in sys.stdin.readline().split()]

	def next_int(self):
		return int(self.next())

	def solve(self):
		t = self.next_int()
		for _ in range(t):
			l = self.next_int()
			s = self.next()
			print('YES' if l >= 11 and '8' in s and (s.index('8') <= l - 11) else 'NO')
Main().solve()


from sys import stdin, stdout
import bisect

def st():
	return list(stdin.readline())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	s = st()
	if '8' not in s:
		print('NO')
	else:
		a = s.index('8')
		if n - a >= 11:
			print('YES')
		else:
			print('NO')
for _ in range(inp()):
	solve()


def isNumber(st):
	for i in range(len(st)):
		if st[i] == '8' and len(st[i:]) >= 11:
			return 'YES'
	return 'NO'
for tc in range(int(input())):
	n = int(input())
	st = input()
	print(isNumber(st))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if n < 11:
		print('NO')
	elif n == 11:
		print('YES' if s[0] == '8' else 'NO')
	elif '8' in s:
		eight = s.index('8') + 1
		print('YES' if n - eight >= 10 else 'NO')
	else:
		print('NO')


t = int(input())
ls = [input() for _ in range(2 * t)]
n = []
s = []
for i in range(2 * t):
	if i % 2 == 0:
		n.append(int(ls[i]))
	elif i % 2 == 1:
		s.append(ls[i])
for j in range(t):
	if n[j] < 11:
		print('NO')
	elif n[j] >= 11:
		m = n[j] - 11
		if '8' in s[j][:m + 1]:
			print('YES')
		else:
			print('NO')


for i in range(int(input())):
	n = int(input())
	s = input()
	ck = False
	for j in range(0, n - 10):
		if s[j] == '8':
			ck = True
			break
	if ck:
		print('YES')
	else:
		print('NO')


def phone(n, s, ch):
	if n == 11 or ch:
		if s[0] == '8':
			return 'YES'
		else:
			return 'NO'
	elif n > 11:
		if '8' in s[:n - 10]:
			return 'YES'
		else:
			return 'NO'
	elif n < 11:
		return 'NO'
cases = int(input())
for a in range(cases):
	n = int(input())
	s = input()
	print(phone(n, s, 0))


def is_telephone(s):
	if '8' not in s:
		return 'NO'
	if len(s[s.index('8'):]) >= 11:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	s = list(input().strip())
	print(is_telephone(s))


q = int(input())
for _ in range(q):
	n = int(input())
	u = list(map(int, list(input())))
	k = -1
	for i in range(n):
		if u[i] == 8:
			k = i
			break
	if k == -1:
		print('NO')
		continue
	if n - k >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	eight_is = '8' in s
	if not eight_is:
		print('No')
		t -= 1
	else:
		index = s.index('8')
		tike = s[index:]
		counter = len(tike)
		if counter < 11:
			print('No')
			t -= 1
		else:
			print('Yes')
			t -= 1


for i in range(int(input())):
	n = int(input())
	s = input()
	c = 0
	if '8' in s:
		if n - s.index('8') >= 11:
			print('YES')
			c = 1
	if c == 0:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input().strip()
	f = 0
	for j in range(n):
		if s[j] == '8' and n - j >= 11:
			f = 1
	if f == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = int(input())
	s = str(input())
	if l < 11:
		print('NO')
	else:
		try:
			f = s.index('8')
			if l - f >= 11:
				print('YES')
			else:
				print('NO')
		except:
			print('NO')


def solve():
	n = int(input())
	num = input()[::-1]
	if n < 11:
		return 'NO'
	for d in num[10:]:
		if d == '8':
			return 'YES'
	return 'NO'

def solution():
	n = int(input())
	for i in range(n):
		print(solve())
solution()


t = int(input())
for i in range(t):
	n = int(input())
	str1 = input()
	if len(str1) >= 11 and str1[0] == '8':
		print('YES')
	elif len(str1) == 11 and str1[0] != '8':
		print('NO')
	elif len(str1) > 11 and str1[0] != '8':
		lst1 = list(str1)
		k = 0
		for i in range(len(str1)):
			if lst1[i] == '8' and len(lst1) - i >= 11:
				print('YES')
				k = 1
				break
		if k == 0:
			print('NO')
		else:
			pass
	else:
		print('NO')


n = int(input())
for i in range(n):
	status = True
	z = int(input())
	k = input()
	if '8' in k:
		l = k.index('8')
	else:
		status = False
		print('NO')
	if status:
		if z - l >= 11:
			print('YES')
		else:
			print('NO')


a = input()
a = int(a)
while a != 0:
	b = input()
	c = input()
	if int(b) < 11:
		print('NO')
	elif int(b) == 11 and c[0] == 8:
		print('YES')
	elif '8' in c:
		index = c.index('8')
		if len(c[index:]) >= 11:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
	a = a - 1


def f(s):
	if '8' in s:
		x = s.find('8')
		if len(s) - x >= 11:
			return 'YES'
		else:
			return 'NO'
	else:
		return 'NO'
n = int(input())
for i in range(n):
	input()
	print(f(input()))


t = int(input())
for _ in range(t):
	n = int(input())
	a = input()
	for i in range(n):
		if a[i] == '8':
			if len(a[i:]) >= 11:
				print('YES')
				break
	else:
		print('NO')


def solve():
	n = int(input())
	s = input()
	try:
		return 'YES' if n >= s.index('8') + 11 else 'No'
	except:
		return 'NO'
print('\n'.join((solve() for _ in range(int(input())))))


for _ in range(int(input())):
	l = int(input())
	s = list(input())
	if l < 11 or '8' not in s:
		print('NO')
	else:
		c = s.count('8')
		flag = 0
		for _ in range(c):
			i = s.index('8')
			if l - i >= 11:
				print('YES')
				flag = 1
				break
		if flag == 0:
			print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input()
	a = n
	for i in range(len(s)):
		if s[i] == '8':
			a = i
			break
	if n - a >= 11:
		print('YES')
	else:
		print('NO')


T = int(input())

def run_test_case(n: int, s: str):
	try:
		i = s.index('8')
	except ValueError:
		return 'NO'
	if n - i >= 11:
		return 'YES'
	return 'NO'
for t in range(T):
	n = int(input())
	s = input()
	result = run_test_case(n, s)
	print(result)


n = int(input())
for i in range(n):
	length = int(input())
	s = input()
	if length < 11:
		print('NO')
	elif s.find('8') == -1:
		print('NO')
	elif len(s[s.index('8'):]) >= 11:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	s = input()
	a = []
	f = 0
	a.extend(s)
	for j in range(0, n - 10):
		if a[j] == '8':
			f = 1
	if f == 1:
		print('YES')
	else:
		print('NO')


inp = lambda cast=int: list(map(cast, input().split()))
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
(t,) = inp()
for _ in range(t):
	(n,) = inp()
	(s,) = inp(str)
	if len(s) >= 11 and '8' in s and (s.index('8') <= len(s) - 11):
		print('YES')
	else:
		print('NO')


n = input()
n = int(n)
x = 0
y = []
for j in range(n):
	lol = int(input())
	a = input()
	a = list(a)
	a = list(map(int, a))
	if 8 in a:
		if len(a) < 11:
			x = 0
		elif len(a) == 11:
			if a[0] == 8:
				x = 1
			else:
				x = 0
		elif len(a) > 11:
			if len(a) - a.index(8) >= 11:
				x = 1
			else:
				x = 0
		y.append(x)
	else:
		y.append(0)
for i in y:
	if i == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	l = int(input())
	s = input()
	pos = s.find('8')
	if pos < 0 or l - pos < 11:
		print('NO')
	else:
		print('YES')


tcase = int(input())
li = []
for case in range(tcase):
	n = int(input())
	b = str(input())
	if len(b) < 11 or n < 11:
		print('NO')
	elif '8' in b[0:n - 11 + 1]:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	x = int(input())
	y = input()
	if y.find('8') == -1 or len(y) < 11:
		print('NO')
	elif y.find('8') > len(y) - 11:
		print('NO')
	else:
		print('YES')


for j in range(int(input())):
	a = int(input())
	b = list(input())
	try:
		p = b.index('8')
		if a - p >= 11:
			print('YES')
		else:
			print('NO')
	except:
		print('NO')


t = int(input(''))
n = []
d = []
for i in range(t):
	n.append(int(input('')))
	d.append(input(''))
for j in d:
	flag = 0
	if len(j) < 11:
		print('NO')
	elif len(j) == 11:
		if j[0] == '8':
			print('YES')
		else:
			print('NO')
	else:
		p = len(j) - 11
		for k in range(p + 1):
			if j[k] == '8':
				flag = 1
		if flag == 1:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	s = int(input())
	a = 'YES'
	m = list(input())
	try:
		ind_8 = m.index('8')
	except ValueError:
		ind_8 = s
	if s - ind_8 - 1 < 10:
		a = 'NO'
	print(a)


for _ in range(int(input())):
	n = int(input())
	s = input()
	first = n + 1
	for j in range(n):
		if s[j] == '8':
			first = j
			break
	if n - first < 11:
		print('No')
	else:
		print('Yes')


t = int(input())
for i in range(t):
	kek = 0
	repeat = True
	n = int(input())
	s = input()
	for j in range(n):
		if s[j] == '8' and repeat:
			kek = n - (j + 1)
			repeat = False
	if kek >= 10:
		print('YES')
	else:
		print('NO')


test_cases = int(input())

def isPhoneNumber(number):
	if '8' in number and len(number[number.index('8'):]) >= 11:
		return 'YES'
	return 'NO'
for i in range(test_cases):
	digits = int(input())
	number = input()
	print(isPhoneNumber(number))


t = int(input())
for f in range(t):
	n = int(input())
	print('YES' if '8' in input()[:-10] else 'NO')


def solve(text):
	for (i, c) in enumerate(text):
		if c == '8':
			l = len(text[i:])
			if l >= 11:
				return 'YES'
	return 'NO'

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		text = input()
		print(solve(text))
main()


def get_result(s):
	if len(s) < 11:
		return 'NO'
	if len(s) == 11:
		if s[0] != '8':
			return 'NO'
		else:
			return 'YES'
	if len(s) > 11:
		if s[0] == '8':
			return 'YES'
		else:
			count = len(s)
			for i in range(len(s)):
				if s[i] != '8':
					count -= 1
				else:
					break
			if count >= 11:
				return 'YES'
			else:
				return 'NO'
no_testcase = int(input())
for t in range(no_testcase):
	len_s = input()
	s = input()
	print(get_result(s))


for _ in range(int(input())):
	n = int(input())
	string = input()
	a = n - 11
	t = 0
	if a < 0:
		t = 1
	elif a == 0 and string[0] != '8':
		t = 1
	else:
		l = list(string)
		while l[0] != '8':
			if a == 0 and l[0] != 8:
				t = 1
				break
			l.pop(0)
			a -= 1
	if t == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	num = input()
	if n >= 11:
		able = 0
		for i in range(n - 10):
			if num[i] == '8':
				print('YES')
				able = 1
				break
		if able == 0:
			print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	k = -1
	for i in range(n):
		if s[i] == '8':
			k = i
			break
	if k == -1:
		print('NO')
	elif n - 1 - i >= 10:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	k = max(int(input()) - 10, 0)
	l = input()
	n = l[:k]
	if n.count('8'):
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	r = input()
	p = list(r)
	z = '8'
	w = 0
	if z not in p:
		print('NO')
	else:
		w = p.index(z)
		if n - w < 11:
			print('NO')
		else:
			print('YES')


from builtins import int, input, enumerate, len, range
LIMIT = 11

def is_phone_number(seq):
	tmp = seq
	for (i, c) in enumerate(seq):
		if len(tmp) < LIMIT:
			return 'NO'
		if seq[i] == '8' and len(tmp) >= LIMIT:
			return 'YES'
		else:
			tmp = tmp[1:]
N = int(input())
for i in range(N):
	ignore = input()
	print(is_phone_number(input()))


t = int(input())
l = []
for i in range(t):
	n = int(input())
	r = input()
	l.append([r, n])
for i in l:
	if len(i[0]) < 11:
		print('NO')
	elif 0 <= i[0].find('8') <= i[1] - 11:
		print('YES')
	else:
		print('NO')


tests = int(input())
for _ in range(tests):
	size = int(input())
	number = input()
	e_pos = number.find('8')
	result = 'NO' if e_pos == -1 or size - e_pos < 11 else 'YES'
	print(result)


query = int(input())
for q in range(query):
	n = int(input())
	s = str(input())
	count = 0
	flag = False
	for i in s:
		if i == '8':
			flag = True
		if flag:
			count += 1
	if count >= 11:
		print('YES')
	else:
		print('NO')


for a0 in range(int(input())):
	n = int(input())
	s = list(input())
	if n >= 11:
		if '8' in s:
			if n - s.index('8') < 11:
				print('NO')
			else:
				print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	s = list(input())
	ans = 'NO'
	if len(s) >= 11:
		for i in range(0, len(s) - 11 + 1, 1):
			if s[i] == '8':
				ans = 'YES'
	print(ans)


def main():
	t = int(input())
	for case in range(t):
		l = int(input())
		num = input()
		idx = num.find('8')
		if idx != -1 and len(num) - idx >= 11:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
q = []
for i in range(t):
	n = int(input())
	s = input()
	s = [char for char in s]
	if n < 11:
		q.append('NO')
	elif n == 11 and s[0] == 8:
		q.append('YES')
	else:
		result = 'NO'
		for j in range(n):
			if int(s[j]) == 8:
				if n - 11 >= j:
					result = 'YES'
				break
		q.append(result)
for i in q:
	print(i)


t = int(input())
javab = []
for i in range(0, t):
	n = int(input())
	s = input()
	if n == 11 and s[0] == '8':
		javab.append('YES')
	elif n < 11 or (n == 11 and s[0] != '8'):
		javab.append('NO')
	elif n > 11 and s[0] == '8':
		javab.append('YES')
	elif n > 11 and s[0] != '8':
		hh = 0
		for j in range(0, n - 10):
			if s[j] == '8':
				hh += 1
				break
		if hh != 0:
			javab.append('YES')
		else:
			javab.append('NO')
for i in javab:
	print(i)


def numer(slowo):
	if len(slowo) < 11:
		return 'NO'
	licznik = 0
	if len(slowo) == 11 and slowo[0] == '8':
		return 'YES'
	for i in range(len(slowo) - 10):
		if slowo[i] == '8':
			for x in range(i, len(slowo)):
				licznik += 1
			if licznik >= 11:
				return 'YES'
	return 'NO'

def telefon(i):
	for x in range(i):
		input()
		slowo = input()
		print(numer(slowo))
i = int(input())
telefon(i)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = input().rstrip()
	for i in range(n):
		if a[i] == '8':
			if n - i >= 11:
				print('YES')
			else:
				print('NO')
			break
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(input())
	if n < 11:
		print('NO')
	elif n == 11 and arr[0] != '8':
		print('NO')
	elif n == 11 and arr[0] == '8':
		print('YES')
	elif n > 11 and '8' not in arr:
		print('NO')
	elif n > 11 and '8' in arr:
		arr.reverse()
		temp = arr[10:]
		if '8' not in temp:
			print('NO')
		else:
			print('YES')


T = int(input())
while T > 0:
	n = int(input())
	s = input()[:-10]
	if '8' in s:
		print('YES')
	else:
		print('NO')
	T -= 1


n = int(input())
for i in range(n):
	p = int(input())
	if p < 11:
		p = input()
		print('NO')
	else:
		k = list(input())
		if '8' in k:
			if p - k.index('8') < 11:
				print('NO')
			else:
				print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	flag = -1
	for i in range(n):
		if s[i] == '8':
			flag = i
			break
	if flag == -1:
		print('NO')
	elif n - flag >= 11:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	c = n + 1
	for i in range(n):
		if s[i] == '8':
			c = i
			break
	if n - c >= 11:
		print('Yes')
	else:
		print('No')


def delete_character(s):
	newS = ''
	for k in range(len(s)):
		if k != 0:
			newS += s[k]
	return newS
t = int(input())
result = []
for i in range(t):
	n = int(input())
	s = input()
	if len(s) == 11 and s[0] != '8':
		result.append('NO')
	if len(s) < 11:
		result.append('NO')
	if len(s) > 11 and s[0] == '8':
		result.append('YES')
	if len(s) == 11 and s[0] == '8':
		result.append('YES')
	if len(s) > 11 and s[0] != '8':
		while s[0] != '8' and len(s) != 1:
			s = delete_character(s)
		if len(s) >= 11:
			result.append('YES')
		else:
			result.append('NO')
for r in result:
	print(r, end='\n')


a = int(input())
for i in range(a):
	n = int(input())
	s = input()
	l = []
	for j in s:
		l.append(int(j))
	f = 0
	if n > 10:
		for j in range(0, n - 10):
			if l[j] == 8:
				f = 1
	if f == 1:
		print('YES')
	else:
		print('NO')


res = []
for i in range(int(input())):
	size = int(input())
	res.append('YES' if '8' in str(input())[:-10] else 'NO')
print('\n'.join(res))


def solve():
	l = int(input())
	s = input()
	for i in range(l):
		if s[i] == '8' and l - i >= 11:
			print('YES')
			return
	print('NO')
	return

def main():
	t = int(input())
	for cas in range(t):
		solve()
main()


input_number = int(input())
phones = []
for i in range(input_number):
	length = int(input())
	phone = [int(char) for char in input()]
	d = {'length': length, 'phone': phone}
	phones.append(dict(d))
for d in phones:
	if d['length'] > 10 and 8 in d['phone'] and (0 <= d['phone'].index(8) <= d['length'] - 11):
		print('YES')
	else:
		print('NO')


q = int(input())
for i in range(0, q):
	n = int(input())
	s = str(input())
	q = 0
	for i in range(0, n - 10):
		if s[i] == '8':
			q = 1
			break
	print('YES') if q == 1 else print('NO')


t = int(input())
for x in range(t):
	n = int(input())
	str = input()
	i8 = str.find('8')
	if 0 <= i8 <= n - 11:
		print('YES')
	else:
		print('NO')


nos = int(input())
for mmm in range(nos):
	ln = int(input())
	num = input()
	if ln < 11:
		print('NO')
	else:
		diff = ln - 11
		towork = num[0:diff + 1]
		if '8' in towork:
			print('YES')
		else:
			print('NO')


a = int(input())
for i in range(a):
	b = int(input())
	c = str(input())
	n = 0
	if b < 11:
		n = 0
	for i in range(b):
		if c[i] == '8' and b - i < 11:
			n = 0
		if c[i] == '8' and b - i >= 11:
			n = 1
			break
	if n == 1:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	input()
	m = str(input())
	if m.find('8') == -1:
		print('NO')
	else:
		g = m.index('8')
		m = m[g:]
		print('YES' if len(m) > 10 else 'NO')


class TelephoneNumber:

	def __init__(self, size, number):
		self.size = size
		self.number = number

	def can_be_a_ph_no(self):
		for index in range(self.size):
			if self.number[index] == '8' and self.size - index - 1 >= 10:
				return 'YES'
			elif self.size - index - 1 < 10:
				return 'NO'
		return 'NO'
t = int(input())
for ti in range(t):
	num = TelephoneNumber(int(input()), input())
	print(num.can_be_a_ph_no())


n = int(input())
for i in range(0, n):
	s = int(input())
	string = input()[:s]
	s1 = list(string)
	if len(string) < 11 or '8' not in s1:
		print('NO')
	else:
		identifier = s1.index('8')
		if s - identifier >= 11 or identifier == 0:
			print('YES')
		else:
			print('NO')