#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
int num[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}};
int main(){
	int n;
	int segment[7]={0,0,0,0,0,0,0};
	int display[7];
	while(cin>>n,n!=-1){
		rep(i,7)segment[i]=0;
		for(int j=0;j<n;j++){
			int nm;
			cin>>nm;
			rep(i,7){
				display[i]=segment[i] xor num[nm][i];
				segment[i]=num[nm][i];
			}
			string s="";
			rep(i,7)s+=(char)(display[i]+'0');
			cout<<s<<endl;
		}
	}
	return 0;
}