#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, i, j;
  string s;
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s;
    for (i = 0; s[i] != '\0'; i++)
      if (s[i] == 56) break;
    if (n - i >= 11)
      cout << "YES";
    else
      cout << "NO";
    cout << "\n";
  }
  return 0;
}
