#include <bits/stdc++.h>
int ans[7] = {0, 0, 0, 0, 0, 0, 0};
int num[10][7] = {{0, 1, 1, 1, 1, 1, 1}, {0, 0, 0, 0, 1, 1, 0},
                  {1, 0, 1, 1, 0, 1, 1}, {1, 0, 0, 1, 1, 1, 1},
                  {1, 1, 0, 0, 1, 1, 0}, {1, 1, 0, 1, 1, 0, 1},
                  {1, 1, 1, 1, 1, 0, 1}, {0, 0, 0, 0, 1, 1, 1},
                  {1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1, 1}};
int main() {
  int I, N;
  int i, n;
  for (;;) {
    scanf("%d", &N);
    if (N == -1) break;
    for (i = 0; i < 7; ++i) ans[i] = 0;
    for (I = 0; I < N; ++I) {
      scanf("%d", &n);
      for (i = 0; i < 7; ++i) {
        printf("%d", ans[i] ^ num[n][i]);
        ans[i] = num[n][i];
      }
      printf("\n");
    }
  }
  return 0;
}
