#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	//gfedcba
	bool tpr[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}};
	bool now[7];
	int in,n;

	while(scanf("%d",&n) && n != -1){
		for(int i = 0; i < 7; i++)
			now[i] = false;
		for(int i = 0; i < n; i++){
			scanf("%d",&in);
			for(int j = 0; j < 7; j++){
				if(tpr[in][j] == now[j])
					printf("0");
				else{
					now[j] = tpr[in][j];
					printf("1");
				}
			}
			printf("\n");
		}
	}
	
	return 0;
}