#include <stdio.h>

#define MAX 20000
#define MYSCAN scanf

int main(void){
	int n, m;
	int i, j;
	int nowseg[7];
	int seg[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 (true){
		MYSCAN("%d", &n);
		if (n == -1){	break;	}
		for (i = 0; i < 7; i++){	nowseg[i] = 0;	}

		for (i = 0; i < n; i++){
			MYSCAN("%d", &m);
			for (j = 0; j < 7; j++){
				if (seg[m][j] == nowseg[j]){
					printf("0");					
				}
				else{
					printf("1");
				}
				nowseg[j] = seg[m][j];
			}
			printf("\n");
		}
	}

	return 0;

}