#include <iostream>
//#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.sevensegment", "r", stdin );

	const string num[] = { 
		"0111111", "0000110", "1011011", "1001111",
		"1100110", "1101101", "1111101", "0100111",
		"1111111", "1101111"
	};
	int n, m;

	while (1){
		string prev (7, '0');
		string curr (7, '0');
		cin >> n;
		if (n == -1){
			break;
		} // end if

		for (int i = 0; i < n; ++i){
			cin >> m;
			for (int j = 0; j < 7; ++j){
				curr[j] = ((num[m][j] - '0') ^ (prev[j] - '0')) + '0'; 
			} // end for
			cout << curr << endl;
			prev = num[m];
		} // end for
	} // end while
		
	return 0;
}