#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int a[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 b[7],c[100],n;
  while(cin>>n&&n!=-1){
    for(i=0;i<n;i++)
      cin>>c[i];
    memset(b,0,sizeof(b));
    for(i=0;i<n;i++){
      for(j=0;j<7;j++){
	cout<<(b[j]^a[c[i]][j]);
	b[j]=(b[j]+(b[j]^a[c[i]][j]))%2;
      }
      cout<<endl;
    }
  }
  return 0;
}