#include <iostream>
using namespace std;
const char* bits[] = {
	"0111111",
	"0000110",
	"1011011",
	"1001111",
	"1100110",
	"1101101",
	"1111101",
	"0100111",
	"1111111",
	"1101111",
};

int main () {
	int n;
	while (cin >> n, n != -1) {
		char current[] = "0000000";
		for (int i = 0; i < n; i++) {
			int x;
			cin >> x;
			for (int i = 0; i < 7; i++) {
				if (current[i] != bits[x][i]) {
					cout << '1';
					current[i] = bits[x][i];
				}
				else {
					cout << '0';
				}
			}
			cout << endl;
		}
	}
	return 0;
}