#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int ara[t];
  for (int tc = 0; tc < t; tc++) ara[tc] = 0;
  for (int tc = 0; tc < t; tc++) {
    int n;
    cin >> n;
    char str[n + 1];
    cin >> str;
    if (n < 11)
      ara[tc] = 0;
    else if (n == 11) {
      if (str[0] == 56)
        ara[tc] = 1;
      else
        ara[tc] = 0;
    } else {
      for (int j = 0; j <= n - 11; j++) {
        if (str[j] == 56) {
          ara[tc] = 1;
          break;
        }
      }
    }
  }
  for (int tc = 0; tc < t; tc++) {
    if (ara[tc] == 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
