#include <iostream>
#include <string>
using namespace std;
string segment(int i){
	if(i==0)
	return "0111111";
	if(i==1)
	return "0000110";
	if(i==2)
	return "1011011";
	if(i==3)
	return "1001111";
	if(i==4)
	return "1100110";
	if(i==5)
	return "1101101";
	if(i==6)
	return "1111101";
	if(i==7)
	return "0100111";
	if(i==8)
	return "1111111";
	if(i==9)
	return "1101111";
}
int main() {
	// your code goes here
	
	int n,m;
	while(cin >> n && n!=0){
	string now="0000000",next;
		for(int i=0;i<n;i++){
			cin >> m;
			next=segment(m);
			for(int j=0;j<7;j++)
			if(now[j]!=next[j])
			cout << 1;
			else
			cout << 0;
			cout << endl;
			now=next;
		}
	}
	return 0;
}