#include <iostream>

using namespace std;

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

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