#include <iostream>
#include <bitset>

using namespace std;

bitset<7> segs[10];

void init() {
	segs[0] = bitset<7>(string("0111111"));
	segs[1] = bitset<7>(string("0000110"));
	segs[2] = bitset<7>(string("1011011"));
	segs[3] = bitset<7>(string("1001111"));
	segs[4] = bitset<7>(string("1100110"));
	segs[5] = bitset<7>(string("1101101"));
	segs[6] = bitset<7>(string("1111101"));
	segs[7] = bitset<7>(string("0100111"));
	segs[8] = bitset<7>(string("1111111"));
	segs[9] = bitset<7>(string("1101111"));
}

int main() {
	init();
	int n;
	while (cin >> n) {
		if (n == -1) break;
		bitset<7> cur((string)"0000000");
		for (int i = 0; i < n; i++) {
			int p; cin >> p;
			cout << (cur ^ segs[p]).to_string() << endl;
			cur = segs[p];
		}
	}
	return 0;
}