#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, x;
  cin >> t;
  while (t--) {
    cin >> x;
    if (x % 4 == 0) {
      long long cnt = x;
      while (cnt) {
        if (x / 4 >= cnt)
          cout << 8;
        else
          cout << 9;
        cnt--;
      }
    } else {
      long long cnt = x;
      while (cnt) {
        if (x / 4 + 1 >= cnt)
          cout << 8;
        else
          cout << 9;
        cnt--;
      }
    }
    cout << endl;
  }
  return 0;
}
