#include <bits/stdc++.h>
using namespace std;
const long long int LL_MAX = 1e18 + 5;
const int MX = INT_MAX;
const long long int mod = 1000000007;
const int maxx = 2e5;
const int d4i[4] = {-1, 0, 1, 0};
const int d4j[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int d8j[8] = {0, 1, 1, 1, 0, -1, -1, -1};
bool rev(int a, int b) { return a >= b; }
string y = "YES", no = "NO";
void solve() {
  long long int x;
  cin >> x;
  ;
  string s = "";
  for (int i = (0); i < (x); i++) s += '8';
  long long int p = ((3 * x) / 4);
  int k = 0;
  while (p--) {
    s[k] = '9';
    k++;
  }
  cout << s << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  for (int i = (1); i < (t + 1); i++) {
    solve();
  };
  return 0;
}
