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