#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
  int n;
  cin >> n;
  string ans = "\n";
  int k = n;
  while (n) {
    if (k) {
      ans = '8' + ans;
      k -= min(k, 4);
    } else
      ans = '9' + ans;
    n--;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int test;
  cin >> test;
  while (test--) solve();
}
