#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	int seg[]{
		0b0111111,
		0b0000110,
		0b1011011,
		0b1001111,
		0b1100110,
		0b1101101,
		0b1111101,
		0b0100111,
		0b1111111,
		0b1101111
	};
	int n;
	while (cin >> n, ~n) {
		int now = 0;
		rep(i, n) {
			int j; cin >> j;
			cout << bitset<7>(seg[j] ^ now) << endl;
			now = seg[j];
		}
	}
}