#include <bits/stdc++.h>
int main(void) {
  int i, j, n, b, a;
  int s[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, 1, 0, 0, 1, 1, 1},
                  {1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1, 1}};
  int ans[7];
  while (scanf("%d", &n), n != -1) {
    b = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", &a);
      for (j = 0; j < 7; j++) {
        if (s[b][j] == s[a][j])
          ans[j] = 0;
        else
          ans[j] = 1;
      }
      b = a;
      for (j = 0; j < 7; j++) {
        printf("%d", ans[j]);
      }
      puts("");
    }
  }
  return 0;
}
