#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, j;
  string s;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n >> s;
    for (j = 0; j < n && s[j] != '8'; j++)
      ;
    if (j < (n - 10))
      cout << "YES" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
