#include<iostream>
using namespace std;
string c[10]={
	"0111111",
	"0000110",
	"1011011",
	"1001111",
	"1100110",
	"1101101",
	"1111101",
	"0100111",
	"1111111",
	"1101111"
};
int n;
int main()
{
	while(cin>>n,n>=0)
	{
		string s="0000000";
		for(;n--;)
		{
			int d;cin>>d;
			for(int j=0;j<7;j++)
			{
				cout<<(s[j]!=c[d][j]);
				s[j]=c[d][j];
			}
			cout<<endl;
		}
	}
}

