import std.stdio;
import std.array;

void binarywrite(int n){
	int[] res;
	while(n){
		res ~= n & 1;
		n >>= 1;
	}

	while(res.length < 7)
		res ~= 0;

	res.reverse;
	while(!res.empty)
		write(res.front), res.popFront();
	writeln("");
}

void main(){
	int[] lights = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x6f];
	int n = 0;
	while(readf("%d\n", &n), ~n){
		int prev_j = 0;
		for(int i=0;i<n;i++){
			int j;
			readf("%d\n", &j);
			binarywrite(prev_j ^ lights[j]);
			prev_j = lights[j];
		}
	}
}