#include <iostream>
using namespace std;

int main() {
  int M[10];
  int N; const int ALL = (1<<7)-1;
  M[0] = ALL-(1<<6);
  M[1] = (1<<1)+(1<<2);
  M[2] = ALL-(1<<2)-(1<<5);
  M[3] = ALL-(1<<4)-(1<<5);
  M[4] = (1<<1)+(1<<2)+(1<<5)+(1<<6);
  M[5] = ALL-(1<<1)-(1<<4);
  M[6] = ALL-(1<<1);
  M[7] = ALL-(1<<3)-(1<<4)-(1<<6);
  M[8] = ALL;
  M[9] = ALL-(1<<4);
  while(cin >> N && (N!=-1)) {
    int S = 0;
    for(int i=0; i<N; i++) {
      int x; cin >> x;
      S ^= M[x];
      for(int j=6; j>=0; j--) {
        cout << (S >> j & 1);
      }
      S = M[x];
      cout << endl;
    }
  }
  return 0;
}