#include <bits/stdc++.h>
using namespace std;

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

int disp[10] = {
0b1111110, 
0b0110000, 
0b1101101, 
0b1111001, 
0b0110011,
0b1011011, 
0b1011111, 
0b1110010, 
0b1111111, 
0b1111011,};

int main(){
	while(true){
		int n;
		cin>>n;
		if(n==-1) break;
		
		int state = 0;
		REP(i, n){
			int x;
			cin>>x;
			int a = disp[x];
			int c = state ^ a;
			REP(i, 7) printf("%d", (c>>i)%2);
			printf("\n");
			state = a;
		}
	}
}