#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define REP(i,b,n) for(i=b;i<n;i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))

using namespace std;

int n;
char seg[11][8] = { "1111110", "0110000", "1101101", "1111001", "0110011", 
					"1011011", "1011111", "1110010", "1111111", "1111011", "0000000"};
					
string solve(int a, int b)
{	
	string res = "";
	
	FOR(i, 0, 7)
	{
		if( seg[a][i] == seg[b][i] )
			res += '0';
		else
			res += '1';
	}
	
	return string(res.rbegin(), res.rend());
}

int main()
{
	while(cin >> n, n != -1)
	{
		int a = 10;
		
		FOR(i, 0, n)
		{
			int b;
			cin >> b;
			cout << solve(a, b) << endl;
			a = b;
		}
		
	}
	
	return 0;
}