#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	//gfedcba1101101
	int n;
	bool  table[10][7]={{0,1,1,1,1,1,1},{0,0,0,0,1,1,0},{1,0,1,1,0,1,1},{1,0,0,1,1,1,1},{1,1,0,0,1,1,0},{1,1,0,1,1,0,1},{1,1,1,1,1,0,1},{0,1,0,0,1,1,1},{1,1,1,1,1,1,1},{1,1,0,1,1,1,1}};
	while(cin>>n,n!=-1){
		bool now[7]={0,0,0,0,0,0,};
		for(int i=0;i<n;i++){
			int tmp;
			cin>>tmp;
			for(int i=0;i<7;i++){
				if(now[i]==table[tmp][i])cout<<0;
				else cout<<1;
				if(i==6)cout<<endl;
			}
			for(int i=0;i<7;i++)now[i]=table[tmp][i];
		}
	}
	return 0;
}