#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1.0);
const double inf = (int)1e8;
int main() {
  int n;
  string segments[11] = {"0111111", "0000110", "1011011", "1001111",
                         "1100110", "1101101", "1111101", "0100111",
                         "1111111", "1101111", "0000000"};
  int before = 10;
  while (cin >> n, n != -1) {
    for (int i = (0); i < unsigned long long(n); ++i) {
      int m;
      cin >> m;
      for (int i = (0); i < unsigned long long(segments[m].size()); ++i) {
        if (segments[before][i] == segments[m][i])
          cout << 0;
        else
          cout << 1;
      }
      cout << endl;
      before = m;
    }
  }
}
