#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

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

int main(){
	
	int n;
	
	while(true){
		
		cin >> n;
		
		if(n == -1){
			break;
		}
		
		string cur_num = "0000000";
		
		for(int i = 0; i < n; i++){
			int num;
			cin >> num;
			
			for(int j = 0; j < 7; j++){
				if(cur_num[j] != str[num][j]){
					cout << "1";
				}else{
					cout << "0";
				}
			}
			cout << endl;
			cur_num = str[num];
		}
		
		
		
	}
	
	return 0;
}