#include <cstdio>
#include <stack>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <climits>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	const char* str[] = {
		"0111111",
		"0000110",
		"1011011",
		"1001111",
		"1100110",
		"1101101",
		"1111101",
		"0100111",
		"1111111",
		"1101111"
	};
	int n;
	while(scanf("%d", &n), ~n){
		char s[] = "0000000";
		rep(i, n){
			int a;
			scanf("%d", &a);
			rep(i, 7){
				if(s[i] != str[a][i])
					putchar('1');
				else
					putchar('0');
				s[i] = str[a][i];
			}
			puts("");
		}
	}
	return 0;
}