#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
int main() {
  enum bit {
    a = 1,
    b = 1 << 1,
    c = 1 << 2,
    d = 1 << 3,
    e = 1 << 4,
    f = 1 << 5,
    g = 1 << 6,
    all = (1 << 7) - 1,
  };
  const int pat[] = {all ^ g,       b | c,       all ^ c ^ f, all ^ e ^ f,
                     b | c | f | g, all ^ b ^ e, all ^ b,     a | b | c | f,
                     all,           all ^ e};
  int n, disp, t;
  while (scanf("%d", &n), n != -1) {
    disp = 0;
    while (n--) {
      scanf("%d", &t);
      disp ^= pat[t];
      for (int i = 6; i >= 0; --i) printf("%d", (disp >> i) & 1);
      printf("\n");
    }
  }
  return 0;
}
