#include<cstdio>

#define	rep(i,n)	for(int i=0;i<n;i++)

using namespace std;

int main(){
	int bit[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x27,0x7f,0x6f};

	for(int n;scanf("%d",&n),~n;){
		int stat=0;
		rep(i,n){
			int a;	scanf("%d",&a);
			int dif=stat^bit[a];
			stat=bit[a];

			rep(j,7)	printf("%d",(bool)(dif&(1<<(6-j))));
			putchar('\n');
		}
	}

	return 0;
}