#include <iostream>
using namespace std;

int main()
{
	int n;
	const char v[10][8] = { "0111111", "0000110", "1011011", "1001111", "1100110", 
							"1101101", "1111101", "0100111", "1111111", "1101111" };

	cin >> n;

	while (n > 0) {
		int d;
		cin >> d;
		cout << v[d] << endl;
		int dp = d;

		for (int i = 1; i < n; i++) {
			cin >> d;
			for (int j = 0; j < 7; j++) {
				if (v[d][j] == v[dp][j])
					cout << 0;
				else
					cout << 1;
			}
			cout << endl;
			dp = d;
		}

		cin >> n;
	}

	return 0;
}

