#include <bits/stdc++.h>
using namespace std;
void solve();
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long _ = 1;
  cin >> _;
  while (_--) solve();
  return 0;
}
void solve() {
  long long n;
  cin >> n;
  string s = "";
  long long e = (n + 3) / 4;
  for (long long i = e; i < n; i++) {
    s += '9';
  }
  for (long long i = 0; i < e; i++) {
    s += '8';
  }
  cout << s << "\n";
}
