#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string str;
    for (int i = 0; i < n; i++) {
      str += "1001";
    }
    for (int i = 0, j = str.size() - 1; i < n; i++, j--) {
      if (i % 4 == 0) str[j] = '0';
    }
    for (int i = 0; i < n; i++) {
      string x = str.substr(i * 4, 4);
      int val = 0, p = 8;
      for (int j = 0; j < 4; j++) {
        if (x[j] == '1') val += p;
        p /= 2;
      }
      cout << val;
    }
    cout << endl;
  }
}
