#include <cstdio>


int n,d;
int num[10]={0x3F,0x6,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x6F};

void p(int st){
	for(int i = 6; i >= 0; i--){
		if((st&(1 << i)) !=0){
			printf("1");
		}
		else{
			printf("0");
		}
	}
	printf("\n");
}

int main(){
	while(scanf("%d",&n),n != -1){
		int st = 0;
		for(int i = 0; i < n; i++){
			scanf("%d",&d);
			st ^= num[d];
			p(st);
			st = num[d];
		}

	}

	return 0;
}