#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
int main() {
  int n;
  string s[10];
  s[0] = "0111111";
  s[1] = "0000110";
  s[2] = "1011011";
  s[3] = "1001111";
  s[4] = "1100110";
  s[5] = "1101101";
  s[6] = "1111101";
  s[7] = "0100111";
  s[8] = "1111111";
  s[9] = "1101111";
  bool bi[9][7];
  for (int i = 0; i < (int)9; ++i)
    for (int j = 0; j < (int)7; ++j) bi[i][j] = (s[i][j] == '1');
  while (cin >> n, n != -1) {
    int a;
    bool prev[7] = {};
    for (int i = 0; i < (int)n; ++i) {
      cin >> a;
      for (int i = 0; i < (int)7; ++i) {
        cout << (bi[a][i] xor prev[i]);
        prev[i] = bi[a][i];
      }
      cout << endl;
    }
  }
}
