#include <bits/stdc++.h>
using namespace std;
const int _dx[] = {0, 1, 0, -1};
const int _dy[] = {-1, 0, 1, 0};
int getInt() {
  int ret = 0, c;
  c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}
const char *disp[10] = {
    "1111110", "0110000", "1101101", "1111001", "0110011",
    "1011011", "1011111", "1110010", "1111111", "1111011",
};
char myxor(char a, char b) { return (a != b) ? '1' : '0'; }
int main() {
  int n;
  while (scanf("%d", &n), n != -1) {
    char b[7];
    for (int i = 0; i < (int)(7); i++) b[i] = '0';
    for (int i = 0; i < (int)(n); i++) {
      int t;
      scanf("%d", &t);
      for (int j = 0; j < (int)(7); j++) {
        putchar(b[6 - j] = myxor(b[6 - j], disp[t][6 - j]));
      }
      puts("");
    }
  }
  return 0;
}
