#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string digit[10] = {"0111111",
						"0000110",
						"1011011",
						"1001111",
						"1100110",
						"1101101",
						"1111101",
						"0100111",
						"1111111",
						"1101111"};
	int n;
	while(cin >> n)
	{
		if(n == -1)
		{
			break;
		}
		string state = "0000000";
		while(n--)
		{
			int num;
			cin >> num;
			string str = digit[num];
			for(int i = 0; i < 7; ++i)
			{
				if(state[i] != str[i])
				{
					state[i] = '1';
				}
				else
				{
					state[i] = '0';
				}
			}
			cout << state << endl;
			state = digit[num];
		}
	}
}

int main()
{
	solve();
	return(0);
}