#include <iostream>
using namespace std;

void i_to_b(int n){
	for(int i=0 ; i<7 ; ++i, n <<= 1){
		cout << ((n & 64)? 1 : 0);
	}
	cout << endl;
}

int main(){
	int n;
	int f[10] = {63,6,91,79,102,109,125,39,127,111};
	while( cin >> n , ~n ){
		int state = 0;
		for(int i=0 ; i<n ; ++i ){
			int d;
			cin >> d;
			i_to_b( state ^ f[d] );
			state = f[d];
		}
	}
}