#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
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[10][7];
  REP(i,10)
    REP(j,7) 
      bi[i][j] = (s[i][j] == '1');
  while(cin >>n, n!=-1) {
    int a;
    bool prev[7] = {};
    REP(i,n) {
      cin >> a;
      REP(i,7) {
        cout << (bi[a][i] xor prev[i]);
        prev[i] = bi[a][i];
      }
      cout << endl;
    }
  }
}