#include <iostream>
using namespace std;

int seg[] = {0x3f, 0x06, 0x5b, 0x4f, 0x66,
	0x6d, 0x7d, 0x27, 0x7f, 0x6f};

int main() {
	int n;
	while(cin >> n, n != -1) {
		int status = 0;
		for(int i = 0; i < n; i++) {
			int in;
			cin >> in;
			status ^= seg[in];
			for(int i = 6; i >= 0; i--) {
				cout << !!(status & (1 << i));
			}
			cout << endl;
			status = seg[in];
		}
	}
}