#include<iostream>
#include<cstdio>
#include<string>
#include<unordered_map>
#include<map>
using namespace std;

int dis[10] = { 63,6,91,79,102,109,125,39,127,111 };
int main()
{
	int a;
	while (cin >> a, a != -1) {
		int now = 0;
		for (int b = 0; b < a; b++) {
			int c;
			cin >> c;
			int d = now^dis[c];
			for (int k = 64; k != 0; k >>= 1) {
				if (d&k)cout << 1;
				else cout << 0;
			}
			cout << endl;
			now = dis[c];
		}
	}
}