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

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

	while (cin >> n) {
		if (n == -1)break;
		string s = "0000000";

		for (int x = 0;x < n;x++) {
			int a;
			cin >> a;

			string ans;

			for (int i = 0;i < 7;i++) {
				if (s[i] != sgmt[a][i])ans.push_back('1');
				else ans.push_back('0');
				s[i] = sgmt[a][i];
			}

			cout << ans << endl;
		}

	}
	return 0;
}