#include<iostream>
#include<vector>
using namespace std;

int main()
{
  int n,m,i,display;
  vector<int> v(10);
  v[0] = 63;
  v[1] = 6;
  v[2] = 91;
  v[3] = 79;
  v[4] = 102;
  v[5] = 109;
  v[6] = 125;
  v[7] = 39;
  v[8] = 127;
  v[9] = 111;
  while(cin>>n,~n){
    display=0;
    while(n-->0){
      cin>>m;
      display^=v[m];
      for(i=1<<6;i>0;i=i>>1) cout<<((display&i)!=0);
      display=v[m];
      cout<<endl;
    }
  }
}