num = int(input()) signal = 0 for i in range(num): n = int(input()) str = input() if n < 11: print("NO") else: for i in range(n - 10): if str[i] == "8": print("YES") signal = 1 break if signal == 0: print("NO")