#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  int l[7] = {0};
  int d[10][7] = {{1, 1, 1, 1, 1, 1, 0}, {0, 1, 1, 0, 0, 0, 0},
                  {1, 1, 0, 1, 1, 0, 1}, {1, 1, 1, 1, 0, 0, 1},
                  {0, 1, 1, 0, 0, 1, 1}, {1, 0, 1, 1, 0, 1, 1},
                  {1, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 0, 1, 0},
                  {1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 0, 1, 1}};
  while (cin >> n, n >= 0) {
    while (n--) {
      int num;
      cin >> num;
      for (int i = 6; i >= 0; i--) {
        cout << (l[i] == d[num][i] ? 0 : 1);
        l[i] = d[num][i];
      }
      cout << endl;
    }
  }
}
