#include <bits/stdc++.h>
using namespace std;
int ss[10][7] = {{0, 1, 1, 1, 1, 1, 1}, {0, 0, 0, 0, 1, 1, 0},
                 {1, 0, 1, 1, 0, 1, 1}, {1, 0, 0, 1, 1, 1, 1},
                 {1, 1, 0, 0, 1, 1, 0}, {1, 1, 0, 1, 1, 0, 1},
                 {1, 1, 1, 1, 1, 0, 1}, {0, 1, 0, 0, 1, 1, 1},
                 {1, 1, 1, 1, 1, 1, 1}, {1, 0, 1, 1, 1, 1, 1}};
int main() {
  for (;;) {
    int n;
    cin >> n;
    if (n == -1) return 0;
    int d[7] = {0};
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      for (int j = 0; j < 7; j++) {
        cout << (d[j] ^ ss[x][j]);
        d[j] = ss[x][j];
      }
      cout << endl;
    }
  }
}
