#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	int n,t;
	char v[10]={63,6,91,79,102,109,125,39,127,111};
	char s[8],a,b;
	for(;;){
		scanf("%d",&n);
		if(n==-1)break;
		a=0;
		rep(i,n){
			scanf("%d",&t);
			b=a^v[t];
			a=v[t];
			rep(j,7)printf("%d",(b & (1<<(6-j))) > 0);
			puts("");
		}
	}
	return 0;
}