#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,x;
	string t[]={"0111111","0000110","1011011","1001111",
		"1100110","1101101","1111101","0100111","1111111","1101111"};
	while(cin>>n,n!=-1){
		string now="0000000";
		while(n--){
			cin>>x;
		string pre=t[x];
		for(int i=0;i<7;i++)
		if(pre[i]!=now[i])
		cout<<1;
		else cout<<0;
		cout<<endl;
		now=pre;
		}
		
	}
	return 0;
}