#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n == 1) {
      cout << 8 << endl;
    } else if (n == 2) {
      cout << 98 << endl;
    } else {
      int k = n - 1;
      int count = k / 4 + 1;
      for (int i = 0; i < n - count; i++) {
        cout << 9;
      }
      for (int i = 0; i < count; i++) {
        cout << 8;
      }
      cout << endl;
    }
  }
}
