// AOJ 0228
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string data[10];
	data[0] = "0111111";
	data[1] = "0000110";
	data[2] = "1011011";
	data[3] = "1001111";
	data[4] = "1100110";
	data[5] = "1101101";
	data[6] = "1111101";
	data[7] = "0100111";
	data[8] = "1111111";
	data[9] = "1101111";

	int n;
	while (cin >> n){
		if (n == -1) break;
		string str = "";
		int a;
		cin >> a; cout << data[a] << endl;
		str = data[a];
		for (int i = 0; i < n - 1; i++){
			cin >> a;
			string out;
			for (int j = 0; j < 7; j++){
				if (str[j] != data[a][j]) out += '1';
				else out += '0';
			}
			cout << out << endl;
			str = data[a];
		}
	}

	return 0;
}