#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  for (int T = 0; T < t; T++) {
    int n;
    cin >> n;
    int zerodigits = 0;
    string ans = "";
    if (n == 1) {
      cout << "8" << endl;
      continue;
    }
    while (zerodigits < n) {
      ans = "8" + ans;
      zerodigits += 4;
    }
    for (int i = ans.length(); i < n; i++) {
      ans = "9" + ans;
    }
    cout << ans << endl;
  }
}
