#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed;
  ll t;
  cin >> t;
  while (t--) {
    ll n;
    cin >> n;
    if (n < 4) {
      if (n == 2) cout << 1 << '\n';
      if (n == 3) cout << 7 << '\n';
      continue;
    }
    ll k = n / 2 - 1;
    string ans;
    if (n % 2 == 1) {
      ans += '7';
    } else {
      ans += '1';
    }
    while (k--) {
      ans += '1';
    }
    cout << ans << '\n';
  }
  return 0;
}
