#include <bits/stdc++.h>
void disp(int change);
int main(void) {
  int num[10] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f};
  for (;;) {
    int i, j, n;
    int pre = 0x00;
    int next = 0x00;
    int change;
    scanf("%d", &n);
    if (n == -1)
      break;
    else {
    }
    for (i = 0; i < n; i++) {
      scanf("%d", &j);
      next = num[j];
      change = pre ^ next;
      pre = next;
      disp(change);
    }
  }
  return 0;
}
void disp(int i) {
  int j;
  int b[7] = {0};
  for (j = 0; i > 0; j++) {
    b[j] = i % 2;
    i = i / 2;
  }
  if (j == 7)
    j--;
  else {
  }
  for (; j >= 0; j--) {
    printf("%d", b[j]);
  }
  printf("\n");
}
