n,v;
s;
S[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x27,0x7f,0x6f};
main(b,i){
	for(;scanf("%d",&n),~n;){
		s=0;
		for(;n--;){
			scanf("%d",&v);
			b=S[v]^s;
			if(b){
				for(i=7;i--;)
					putchar('0'+(b>>i)%2);
				puts("");
			}
			s^=b;
		}
	}
	exit(0);
}