#include<iostream>
using namespace std;

char dig[10][8] = {"0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111"};
char dc[10][10][8];
int main() {
	int n, num, buf;
	for(int i=0; i<10; ++i) for(int j=0; j<10; ++j) {
		for(int k=0; k<7; ++k) dc[i][j][k] = '0'+((dig[i][k]-'0')^(dig[j][k]-'0')); dc[i][j][7] = 0;
	}
	while(1) {
		cin >> n; if(n==-1) break;
		buf = -1;
		for(int i=0; i<n; ++i) {
			cin >> num;
			cout << (buf==-1?dig[num]:dc[buf][num]) << endl;
			buf = num;
		}
	}
	return 0;
}