#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
#define PI acos(-1)
using namespace std;
int def[10][7]={
  {0,1,1,1,1,1,1},
  {0,0,0,0,1,1,0},
  {1,0,1,1,0,1,1},
  {1,0,0,1,1,1,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 main(){
  int n;
  while(cin>>n,n+1){
    int in;
    cin>>in;
    int now[7]={0};
    rep(i,7){
      now[i]=def[in][i];
      cout<<def[in][i];
    }
    cout<<endl;
    rep(i,n-1){
      cin>>in;
      rep(j,7){
	if(now[j]==def[in][j])cout<<0;
	else cout<<1;
	now[j]=def[in][j];
      }
      cout<<endl;
    }
  }


}