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