#include<iostream>
using namespace std;

/*
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 a
1011 b
1100 c
1101 d
1110 e
1111 f
*/

const unsigned char BIT_DATA[10] = {
	0x3f,
	0x06,
	0x5b,
	0x4f,
	0x66,
	0x6d,
	0x7d,
	0x27,
	0x7f,
	0x6f
};

void showAsBinary(unsigned char num){
	for(int i = 0;i < 7;i++){
		if(num & (0x40 >> i)) cout << '1';
		else cout << '0';
	}
	cout << endl;
}

int main(){
	
	int n;
	while(1){
		cin >> n;
		if(n == -1) break;
		unsigned char data = 0;
		for(int i = 0;i < n;i++){
			int num;
			cin >> num;
			showAsBinary(data ^ BIT_DATA[num]);
			data = BIT_DATA[num];
		}
	}
	
	return 0;
}