#include <bits/stdc++.h>
using namespace std;
int main() {
  long t;
  cin >> t;
  while (t--) {
    long long int n, x;
    cin >> n;
    x = ceil((float)n / 4);
    for (long long int i = 0; i < n - x; i++) cout << "9";
    for (long long int i = 0; i < x; i++) cout << "8";
    cout << endl;
  }
  return 0;
}
