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

int main(){
	string seg[10] =
	{
	"0111111","0000110","1011011","1001111","1100110",
	"1101101","1111101","0100111","1111111","1101111"
	};
	int n;
	while(1){
		cin >> n;
		if(n == -1) break;
		int cou = n;
		string now;
		while(cou--){
			int num; cin >> num;
			if(cou == n-1) {
				cout << seg[num] << endl;
				now = seg[num];
			}
			else {
				for(int i=0;i<7;i++){
					if(now[i] == seg[num][i]) cout << "0";
					else cout << "1";
				}
				cout << endl;
				now = seg[num];
			}
		}
	}
}