#include <bits/stdc++.h>
using namespace std;
int main() {
  const char* str[] = {"0111111", "0000110", "1011011", "1001111", "1100110",
                       "1101101", "1111101", "0100111", "1111111", "1101111"};
  int n;
  while (scanf("%d", &n), ~n) {
    char s[] = "0000000";
    for (int i = 0; i < int(n); ++i) {
      int a;
      scanf("%d", &a);
      for (int i = 0; i < int(7); ++i) {
        if (s[i] != str[a][i])
          putchar('1');
        else
          putchar('0');
      }
      puts("");
    }
  }
  return 0;
}
