#include <bits/stdc++.h>
using namespace std;
int t, n;
string s;
bool k;
void in_put() { cin >> n >> s; }
void solve() {
  for (int i = 0; i <= n - 11; i++)
    if (s[i] == '8') k = true;
}
void out_put() {
  cout << (k ? "YES" : "NO");
  cout << endl;
}
void clear() { k = false; }
int main() {
  cin >> t;
  while (t--) {
    in_put();
    solve();
    out_put();
    clear();
  }
}
