#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    int s[] = {63,6,91,79,102,109,125,39,127,111};
    while(true){
	int n;
	cin >> n;
	if(n==-1) break;
	int now = 0;
	REP(i,n){
	    int a;
	    cin >> a;
	    now ^= s[a];
	    string ans = "";
	    int temp = now;
	    now = s[a];
	    while(temp>0){
		ans += (char)(temp%2+'0');
		temp/=2;
	    }
	    REP(i,7-ans.size()) cout << "0";
	    RREP(i,ans.size()) cout << ans[i];
	    cout << endl;
	}
    }
    return 0;
}