#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P,P> P2;
const int INF = 1 << 30;
const double EPS = 1E-9;

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

int main(){
	int n;
	while(cin >> n && n >= 0){
		string s = "0000000";
		int num;
		for(int i = 0; i < n; i++){
			cin >> num;
			string s2;
			string next = nums[num];
			for(int j = 0; j < 7; j++){
				if(next[j] == s[j]){
					s2.push_back('0');
				}else{
					s2.push_back('1');
				}
			}
			s = next;
			cout << s2 << endl;
		}
	}
	return 0;
}