#include <cstdio>

void binarywrite(int n){
	for(int i=6;i>=0;i--){
		printf("%d", (n >> i & 1));
	}
	puts("");
}

int main(){
	int lights[] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f};
	int n = 0;
	while(scanf("%d", &n), ~n){
		int prev_light = 0;
		for(int i=n;i;i--){
			int j;
			scanf("%d", &j);
			binarywrite(prev_light ^ lights[j]);
			prev_light = lights[j];
		}
	}
	return 0;
}