#include <bits/stdc++.h>
int main(void) {
  int n, m;
  int i, j;
  int nowseg[7];
  int seg[10][7] = {{0, 1, 1, 1, 1, 1, 1}, {0, 0, 0, 0, 1, 1, 1},
                    {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, 1, 0, 0, 1, 1, 1},
                    {1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1, 1}};
  while (true) {
    scanf("%d", &n);
    if (n == -1) {
      break;
    }
    for (i = 0; i < 7; i++) {
      nowseg[i] = 0;
    }
    for (i = 0; i < n; i++) {
      scanf("%d", &m);
      for (j = 0; j < 7; j++) {
        if (seg[m][j] == nowseg[j]) {
          printf("0");
        } else {
          printf("1");
        }
        nowseg[j] = seg[m][j];
      }
      printf("\n");
    }
  }
  return 0;
}
