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