#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int x = (n + 3) / 4;
    int p = n - x;
    while (p--) cout << "9";
    while (x--) cout << "8";
    cout << endl;
  }
}
