#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(), cout.tie();
  int t, f = 0;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int p = n * 4;
    p -= n;
    int vagfol = p / 4;
    int hate = n - vagfol;
    for (int i = 0; i < vagfol; i++) cout << 9;
    for (int i = 0; i < hate; i++) cout << 8;
    cout << endl;
  }
}
