#include <iostream>
#include <bitset>
using namespace std;

int seg[10] = {63,6,91,79,102,109,125,39,127,111};

int main() {
	int n, m;
	while (cin >> n, 0 <= n) {
		bitset<7> b(0);
		for (int i=0; i<n; ++i) {
			cin >> m;
			b ^= bitset<7>(seg[m]);
			cout << b << endl;
			b = bitset<7>(seg[m]);
		}
	}
	return 0;
}