#include <bits/stdc++.h>
using namespace std;
const int M = 100005;
int main() {
  int i, j, n, a, b, k = 0, p, m, t;
  string s;
  cin >> t;
  while (t--) {
    scanf("%d", &n);
    cin >> s;
    for (i = 0; i < n; i++) {
      if (s[i] == '8') break;
    }
    if ((n - (i)) >= 11)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
