using namespace std;
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>

typedef vector<int> VI;
typedef pair<int, int> PII;

#define REP(i, n) for(int i=0; i<n; i++)

int SEG[10] = {
	0x01111110,
	0x00110000,
	0x01101101,
	0x01111001,
	0x00110011,
	0x01011011,
	0x01011111,
	0x01110010,
	0x01111111,
	0x01111011
};

int t, n;
int d = 0;

void solve(int n)
{
	int s = SEG[n];
	REP(i, 7)
	{
		if((s&1) ^ (d&1)) cout << "1";
		else cout << "0";
		s >>= 4;
		d >>= 4;
	}
	cout << endl;
	d = SEG[n];
}

int main()
{
	while( 1 )
	{
		cin >> t;
		if(t==-1)
			break;

		d = 0;
		REP(i, t)
		{
			cin >> n;
			solve(n);
		}
	}
}