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

int main()
{
	int a, b, i;
	string n, d[10] = { "0111111" , "0000110" , "1011011" , "1001111" , "1100110" , "1101101" , "1111101" , "0100111" , "1111111" , "1101111" };
	while (cin >> a)
	{
		if (a == -1)break;
		n = "0000000";
		for (i = 0; i < a; i++)
		{
			cin >> b;
			for (int j = 0; j < 7; j++)
			{
				if (n[j] == d[b][j])
				{
					cout << "0";
				}
				else
				{
					cout << "1";
				}
			}
			n = d[b];
			cout << endl;
		}
	}
}