#include<iostream>
using namespace std;
int x[10][7] = {
	{0,1,1,1,1,1,1},
	{0,0,0,0,1,1,0},
	{1,0,1,1,0,1,1},
	{1,0,0,1,1,1,1},
	{1,1,0,0,1,1,0},
	{1,1,0,1,1,0,1},
	{1,1,1,1,1,0,1},
	{0,1,0,0,1,1,1},
	{1,1,1,1,1,1,1},
	{1,1,0,1,1,1,1}
};
int p[7];
int main() {
	int n, a;
	while (true) {
		cin >> n; if (n == -1) { break; }
		for (int i = 0; i < 7; i++) { p[i] = 0; }
		for (int i = 0; i < n; i++) {
			cin >> a;
			for (int j = 0; j < 7; j++) {
				cout << (p[j] ^ x[a][j]);
				p[j] = x[a][j];
			}
			cout << endl;
		}
	}
}