#include <bits/stdc++.h>
using namespace std;
const int A = 1, B = 2, C = 4, D = 8, E = 16, F = 32, G = 64;
int sig[10];
int main() {
  sig[0] = 1 + B * 1 + C * 1 + D * 1 + E * 1 + F * 1 + G * 0;
  sig[1] = 0 + B * 1 + C * 1 + D * 0 + E * 0 + F * 0 + G * 0;
  sig[2] = 1 + B * 1 + C * 0 + D * 1 + E * 1 + F * 0 + G * 0;
  sig[3] = 1 + B * 1 + C * 1 + D * 1 + E * 0 + F * 0 + G * 1;
  sig[4] = 0 + B * 1 + C * 1 + D * 0 + E * 0 + F * 1 + G * 1;
  sig[5] = 1 + B * 0 + C * 1 + D * 1 + E * 0 + F * 1 + G * 1;
  sig[6] = 1 + B * 0 + C * 1 + D * 1 + E * 1 + F * 1 + G * 1;
  sig[7] = 1 + B * 1 + C * 1 + D * 0 + E * 0 + F * 1 + G * 0;
  sig[8] = 1 + B * 1 + C * 1 + D * 1 + E * 1 + F * 1 + G * 1;
  sig[9] = 1 + B * 1 + C * 1 + D * 1 + E * 0 + F * 1 + G * 1;
  int n;
  while (cin >> n) {
    if (n == -1) break;
    int disp = 0, next = 0, ans = 0;
    for (int i = 0; i < n; i++) {
      cin >> next;
      ans = sig[next] ^ disp;
      for (int j = 0; j < 7; j++) cout << (ans >> (6 - j) & 1);
      cout << endl;
      disp = sig[next];
    }
  }
  return 0;
}
