#include<stdio.h>
int main()
{
	char*s[]={	"0111111",
				"0000110",
				"1011011",
				"1001111",
				"1100110",
				"1101101",
				"1111101",
				"0100111",
				"1111111",
				"1101111",};
	int n,x,i;
	while(scanf("%d",&n),n>=0)
	{
		char l[10]="0000000";
		while(n--)
		{
			scanf("%d",&x);
			for(i=0;i<7;++i)
				printf("%d",l[i]!=s[x][i]),l[i]=s[x][i];
			puts("");
		}
	}
	return 0;
}