// 0228
#include <iostream>
using namespace std;

int digit[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(){
	while(1){
		int n, num, display[7] = {0};

		cin>>n;
		if(n == -1)
			break;

		for(int i=0;i<n;i++){
			cin>>num;

			for(int j=0;j<7;j++){
				if(display[j] != digit[num][j])
					cout<<"1";
				else
					cout<<"0";

				display[j] = digit[num][j];
			}
			cout<<endl;
		}
	}
	return 0;
}