#include<iostream>
#include<cstring>

using namespace std;    
const int turn[10][8]={{1,1,1,1,1,1,0},{0,1,1,0,0,0,0},{1,1,0,1,1,0,1},{1,1,1,1,0,0,1},{0,1,1,0,0,1,1},{1,0,1,1,0,1,1},{1,0,1,1,1,1,1},{1,1,1,0,0,1,0},{1,1,1,1,1,1,1},{1,1,1,1,0,1,1}};

int main(void){
	int n;
	int a,b;
	int seven[8];
	while(1){
		cin >> n;
		if(n==-1)break;
		memset(seven,0,sizeof(seven));
		for(a=0;a<n;a++){
			int nn;
			cin >> nn;
			for(b=0;b<7;b++){
				if(turn[nn][b]!=seven[b])seven[b]=1;
				else seven[b]=0;
			}
			for(b=6;b>=0;b--)printf("%d",seven[b]);
			printf("\n");
			for(b=0;b<7;b++)seven[b]=turn[nn][b];
		}
	}
	return 0;
}