#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
int main(){
	
	int n;
	map<int,string> d;
	
	d[0]="0111111";
	d[1]="0000110";
	d[2]="1011011";
	d[3]="1001111";
	d[4]="1100110";
	d[5]="1101101";
	d[6]="1111101";
	d[7]="0100111";
	d[8]="1111111";
	d[9]="1101111";
	
	while(cin>>n,n!=-1){
		int a;
		cin>>a;
		cout<<d[a]<<endl;
		n--;
		for(int i=0;i<n;i++){
			int b;
			cin>>b;
			string s;
			for(int j=0;j<7;j++){
			if(d[a][j]==d[b][j])
				s+="0";
			else
				s+="1";
			}
			cout<<s<<endl;
			a=b;
		}
	}
}