#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

int N;
char number[11][8] = {
		"0111111",//0
		"0000110",//1
		"1011011",//2
		"1001111",//3
		"1100110",//4
		"1101101",//5
		"1111101",//6
		"0100111",//7
		"1111111",//8
		"1101111",//9
		"0000000"//default
};

void func(){
	int num,pre = 10;

	for(int loop = 0; loop < N; loop++){
		scanf("%d",&num);

		for(int i = 0; i <= 6; i++){
			if(number[num][i] == number[pre][i]){
				printf("0");
			}else{
				printf("1");
			}
		}
		printf("\n");
		pre = num;
	}

}


int main(){

	while(true){
		scanf("%d",&N);
		if(N == -1)break;

		func();
	}

	return 0;
}