#include<bits/stdc++.h>

using namespace std;

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


int main() {
	int n, d;
	string now;

	while (cin >> n, n != -1) {
		now = "0000000";
		for (int i = 0; i < n; ++i) {
			cin >> d;
			//cout << d << endl;
			for (int i = 0; i < 7; ++i) {
				cout << (now[i]^Display[d][i]);
			}
			cout << endl;
			now = Display[d];
		}
	}

	return 0;
}
