#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

string s[10]={"1111110",
			  "0110000",
			  "1101101",
			  "1111001",
			  "0110011",
			  "1011011",
			  "1011111",
			  "1110010",
			  "1111111",
			  "1111011"};

signed main() {
	int n;
	while(1){
		cin >> n;
		if(n == -1) break;
		int a;
		string now = "0000000";
		rep(i, 0, n){
			cin >> a;
			string ans = "";
			repb(j, 6, 0){
				if(now[j] != s[a][j]) cout<< 1;
				else cout<< 0;
			}
			cout << endl;
			now = s[a];
		}
	}
}