#include <bits/stdc++.h>
int n, a[101];
const char c[11][8] = {"0000000", "0111111", "0000110", "1011011",
                       "1001111", "1100110", "1101101", "1111101",
                       "0100111", "1111111", "1101111"};
int main() {
  a[0] = -1;
  while (true) {
    scanf("%d", &n);
    if (n == 0) break;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      for (int j = 0; j < 7; j++) {
        if (c[a[i - 1] + 1][j] != c[a[i] + 1][j]) {
          printf("1");
        } else {
          printf("0");
        }
      }
      printf("\n");
    }
  }
  return 0;
}
