#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pi;
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair

int n;

	
int main(){
	int n;
	string num[]={"1111110",
	"0110000",
	"1101101",
	"1111001",
	"0110011",
	"1011011",
	"1011111",
	"1110010",
	"1111111",
	"1111011",
	"0000000",
	};
	
	while(cin>>n){
		if(n==-1)break;
		
		int zen=10;
		rep(i,n){
			int t;
			cin>>t;
			rep(j,7){
				cout<<!(num[t][6-j]==num[zen][6-j]);
			}
			cout<<endl;
			zen=t;
		}
	}
}