#include <bits/stdc++.h>
using namespace std;
int t[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}};
int n, a, b;
int main() {
  while (1) {
    cin >> n;
    if (n == -1) break;
    cin >> a;
    for (int i = 6; i >= 0; i--) cout << t[a][i];
    cout << endl;
    for (int j = 1; j < n; j++) {
      b = a;
      cin >> a;
      if (b == a) continue;
      for (int i = 6; i >= 0; i--) {
        cout << (t[a][i] != t[b][i] ? '1' : '0');
      }
      cout << endl;
    }
  }
  return 0;
}
