// 0228.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
int main()
{
	ios::sync_with_stdio(false);
	string a[10];
	a[0] = "0111111";
	a[1] = "0000110";
	a[2] = "1011011";
	a[3] = "1001111";
	a[4] = "1100001";
	a[5] = "1101101";
	a[7] = "0100111";
	a[6] = "1111101";
	a[8] = "1111111";
	a[9] = "1101111";
	while (true) {

		ll n;
		cin >> n;
		if (n == -1) { break; }
		string  s = "0000000";
		for (int i = 0; i < n; i++) {
			int d;
			cin >> d;
			for (int j = 0; j < 7; j++) {
				if (a[d][j] == s[j]) { cout << 0; }
				else { cout << 1; }
			}
			cout << endl;
			s = a[i];
		}
	
	}
	
	return 0;
}