#include <bits/stdc++.h>
int main(void) {
  unsigned int current;
  unsigned int need;
  int n, i, j, sn;
  unsigned int bit[7];
  int data[10] = {0x3f, 0x06, 0x5a, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f};
  while (1) {
    current = 0;
    scanf("%d", &n);
    if (n == -1) {
      break;
    }
    for (j = 0; j < n; j++) {
      scanf("%d", &sn);
      need = current ^ data[sn];
      current = data[sn];
      for (i = 0; i < 7; i++) {
        bit[i] = need % 2;
        need /= 2;
      }
      for (i = 6; i >= 0; i--) {
        printf("%d", bit[i]);
      }
      putchar('\n');
    }
  }
  return 0;
}
