#include <bits/stdc++.h>
int main() {
  int i, j, n;
  char L[][8] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                 "1101101", "1111101", "0100111", "1111111", "1111110"};
  while (1) {
    scanf("%d", &n);
    if (n == -1) break;
    char b[] = "0000000";
    int p = 10;
    for (i = 0; i < n; i++) {
      int a;
      scanf("%d", &a);
      for (j = 0; j < 7; j++) {
        if (L[a][j] == L[p][j])
          b[j] = '0';
        else
          b[j] = '1';
      }
      p = a;
      printf("%s\n", b);
    }
  }
  return 0;
}
