#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int test = 1;
  cin >> test;
  for (int loop = 0; loop < test; loop++) {
    long long int num;
    string str;
    cin >> num >> str;
    if (num > 11) {
      long long int res = 0;
      for (int i = 0; i < str.length() - 10; i++) {
        if (str[i] == '8') res = 1;
      }
      if (res)
        cout << "YES\n";
      else
        cout << "NO\n";
    } else if (num == 11) {
      if (str[0] == '8')
        cout << "YES\n";
      else
        cout << "NO\n";
    } else
      cout << "NO\n";
  }
}
