#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

const int T[][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 n;
int a[7];

int main()
{
	while (cin >> n, ~n){
		memset(a, 0, sizeof(a));
		rep(i, n){
			int b;
			cin >> b;
			rep(j, 7){
				cout << (a[j] ^ T[b][j]);
				a[j] = T[b][j];
			}
			cout << endl;
		}
	}
}