#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int N = 4 * n;
  int x = N - n;
  x = x / 4;
  for (int i = 0; i < x; i++) {
    cout << 9;
  }
  for (int i = 0; i < n - x; i++) {
    cout << 8;
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  cin >> tc;
  while (tc--) solve();
  return 0;
}
