#include<iostream>
#include<string>

using namespace std;

string seg[10] = {
"0111111",
"0000110",
"1011011",
"1001111",
"1100110",
"1101101",
"1111101",
"0100111",
"1111111",
"1101111"
};

int in,now;

string ans;

void solve(){
	ans.clear();
	for(int i=0; i<7; i++){
		if(seg[now][i] != seg[in][i])
			ans += '1';
		else
			ans += '0';
	}
	now = in;
}

int main(){
	int n;
	while(true){
		cin >> n;
		if(n == -1)
			return 0;
		for(int i=0; i<n; i++){
			cin >> in;
			if(i==0){
				now = in;
				cout << seg[now] << endl;
				continue;
			}
			solve();
			cout << ans << endl;
		}
	}
}