#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 20, K = 19;
const int mod = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    string x;
    cin >> n >> x;
    int idx = -1;
    for (int i = 0; i < n; i++) {
      if (x[i] == '8') {
        idx = i;
        break;
      }
    }
    if (idx == -1)
      puts("No");
    else {
      if (n - idx >= 11)
        puts("Yes");
      else
        puts("No");
    }
  }
  return 0;
}
