#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int s[]={63,6,91,79,102,109,125,39,127,111},n;

int main(){
	while(cin>>n&&n!=-1){
		int c=0,m;
		rep(i,n){
			cin>>m;
			rep(i,7)cout<<((c^s[m])/(int)pow(2.0,6-i))%2;cout<<endl;
			c=s[m];
		}
	}
}