#include <bits/stdc++.h>
int main() {
  while (true) {
    int n, a[100];
    int mask[10];
    mask[0] = 1 + 2 + 4 + 8 + 16 + 32;
    mask[1] = 2 + 4;
    mask[2] = 1 + 2 + 8 + 16 + 64;
    mask[3] = 1 + 2 + 8 + 16 + 64;
    mask[4] = 2 + 4 + 32 + 64;
    mask[5] = 1 + 4 + 8 + 32 + 64;
    mask[6] = 1 + 4 + 8 + 16 + 32 + 64;
    mask[7] = 1 + 2 + 4 + 32;
    mask[8] = 1 + 2 + 4 + 8 + 16 + 32 + 64;
    mask[9] = 1 + 2 + 4 + 8 + 32 + 64;
    scanf("%d", &n);
    if (n == -1) break;
    for (int i = 0; i < n; ++i) {
      scanf("%d", a + i);
    }
    int state = 0;
    for (int i = 0; i < n; ++i) {
      int sig = state ^ mask[a[i]];
      for (int bit = 6; bit >= 0; --bit)
        printf("%c", sig & (1 << bit) ? '1' : '0');
      printf("\n");
      state = mask[a[i]];
    }
  }
  return 0;
}
