#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double EPS = 1e-6;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const long long INFINF = 1e18;
const int INF = 1e9;
const int maxN = 1e6;
int T;
void tc() {
  int N;
  cin >> N;
  string second = "";
  int d = 0;
  for (int i = 0; i < N; i++) {
    if (d < N) {
      second += "8";
      d += 4;
    } else {
      second += "9";
    }
  }
  reverse(second.begin(), second.end());
  cout << second << endl;
}
int main() {
  cin >> T;
  while (T--) {
    tc();
  }
}
