#include <bits/stdc++.h>
using namespace std;
void print(int arr[], int n) {
  for (int i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  cout << "\n";
}
int main() {
  long long t, n, r;
  cin >> t;
  while (t--) {
    string s = "";
    cin >> n;
    for (int i = 0; i < n; i++) {
      s += '9';
    }
    r = ceil(double(n) / double(4));
    for (int i = 1; i <= r; i++) {
      s[n - i] = '8';
    }
    cout << s << endl;
  }
}
