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