#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  map<int, string> d;
  d[0] = "0111111";
  d[1] = "0000110";
  d[2] = "1011011";
  d[3] = "1001111";
  d[4] = "1100110";
  d[5] = "1101101";
  d[6] = "1111101";
  d[7] = "0100111";
  d[8] = "1111111";
  d[9] = "1101111";
  while (cin >> n, n != -1) {
    int a;
    for (int i = 0; i < n; i++) {
      cin >> a;
      cout << d[a] << endl;
    }
  }
}
