#include<stdio.h>

int main(void)
{
 	int kazu_N,kazu_M;
	int cut_i,cut_j;
	int ans[7];
	int num[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}};

	while(1){
		scanf("%d",&kazu_N);
		int now[7]={0,0,0,0,0,0,0};		
		
		if(kazu_N==-1){
			break;
		}
		
		for(cut_i=0;cut_i<kazu_N;cut_i++){
			scanf("%d",&kazu_M);
			for(cut_j=0;cut_j<7;cut_j++){
				if(num[kazu_M][cut_j]!=now[cut_j]){
					ans[cut_j]=1;
				}
				else {
					ans[cut_j]=0;
				}
				now[cut_j]=num[kazu_M][cut_j];
			}
			for(cut_j=0;cut_j<7;cut_j++){
				printf("%d",ans[cut_j]);
				if(cut_j==6){
					printf("\n");
				}
			}
		}
	}
	return 0;
}