#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>

using namespace std;





int main()
{
	string signal[10] = {
		"0111111",	//0
		"0000110",	//1
		"1011011",	//2
		"1001111",	//3
		"1100110",	//4
		"1101101",	//5
		"1111101",	//6
		"0100111",	//7
		"1111111",	//8
		"1101111"	//9
	};
	int n;
	int num;
	string now_signal;
	string send_signal;
	
	while (cin >> n)
	{
		if (n == -1) break;
		now_signal = "0000000";
		for (int i=0; i<n; i++)
		{
			cin >> num;
			send_signal = "";
			for (int j=0; j<7; j++)
			{
				if (now_signal[j] == signal[num][j])
				{
					send_signal += "0";
				} else {
					send_signal += "1";
				}
			}
			cout << send_signal << endl;
			now_signal = signal[num];
		}
	}
	
	return 0;
}