#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

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