#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n = 0, in;
  int array[][8] = {{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, 1, 0, 1, 1, 1, 1}};
  int box[] = {0, 0, 0, 0, 0, 0, 0};
  while (cin >> n, n != -1) {
    while (n--) {
      cin >> in;
      for (int i = 0; i < 7; i++) {
        cout << (box[i] != array[in][i] ? 1 : 0);
        box[i] = array[in][i];
      }
      cout << endl;
    }
  }
}
