#include <bits/stdc++.h>
using namespace std;
using db = long double;
using pll = pair<long long, long long>;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, i, x, j, y, z, k, n;
  long long tt;
  cin >> tt;
  for (long long _tt = 0; _tt < tt; _tt++) {
    cin >> n;
    x = 0;
    std::vector<long long> v, t;
    for (i = 0; i < n; i += 1) t.push_back(4);
    j = i = 0;
    while (j < n) {
      j += 4;
      v.push_back(8);
      i++;
    }
    while (i < n) {
      v.push_back(9);
      i++;
    }
    reverse((v).begin(), (v).end());
    for (auto zx : v) cout << zx;
    42;
    cout << "" << '\n';
    ;
  }
}
