#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	string num[] = {"0111111",
				  "0000110",
				  "1011011",
			      "1001111",
				  "1100110",
				  "1101101",
	              "1111101",
				  "0100111",
	              "1111111",
	              "1101111"};



	while(1){
		string s = "0000000";
		int n; cin >> n;
		if(n == -1) break;
		for (int i = 0;i < n;i++){
			int next;cin >> next;
			string ans = "0000000";
			for (int i = 0;i < 7;i++){
				if(s[i] == num[next][i])ans[i] = '0';
				else ans[i] = '1';
			}
			s = num[next];
			cout << ans << endl;
		}
	}

	return 0;

}

