#include <bits/stdc++.h>
using namespace std;
int main() {
  long long test;
  cin >> test;
  while (test--) {
    long long n;
    cin >> n;
    long long e = (n + 3) / 4;
    for (long long i = 0; i < n - e; i++) cout << "9";
    for (long long i = 0; i < e; i++) cout << "8";
    cout << endl;
  }
}
