#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	char s[10][8] = {"0111111", "0000110", "1011011", "1001111", "1100110", "1101101", "1111101", "0100111", "1111111", "1101111"};
	int n, a, i, j;
	while (cin >> n)
	{
		if (n < 0) break;
		char t[8] = "0000000";
		for (i = 0; i < n; i++)
		{
			cin >> a;
			for (j = 0; j < 8; j++)
			{
				if (t[j] == s[a][j])	t[j] = '0';
				else					t[j] = '1';
			}
			t[7] = '\0';
			cout << t << endl;
			strcpy(t, s[a]);
		}
	}
}