#include <iostream>
#include <string>
using namespace std;

int main(){
	int n,i,a,j,b;
	string digit[10] = { "0111111","0000110","1011011","1001111","1100110","1101101","1111101","0100111","1111111","1101111" },str;
	while(1){
		str == "";
		cin >> n;
		if(n == -1) break;
		for(i = 0;i < n;++i){
			cin >> a;
			if(i == 0){
				cout << digit[a];
				str = digit[a];
			}
			else {
				for(j = 0;j < 7;++j){
					b = (int)(digit[a][j] - str[j]);
					if(b < 0) b *= -1;
					cout << b;
				}
				str = digit[a];
			}
			cout << "\n";
		}
	}
	return 0;
}