#include <iostream>
#include <bitset>
#include <string>
using namespace std;

bitset<7> ZERO(string("0111111"));
bitset<7>  ONE(string("0000110"));
bitset<7>  TWO(string("1011011"));
bitset<7> THREE(string("1001111"));
bitset<7> FOUR(string("1100110"));
bitset<7> FIVE(string("1101101"));
bitset<7>  SIX(string("1111101"));
bitset<7> SEVEN(string("0100111"));
bitset<7> EIGHT(string("1111111"));
bitset<7> NINE(string("1101111"));
bitset<7> decode(int x){
	switch (x) {
		case 0: return ZERO;
		case 1: return ONE;
		case 2: return TWO;
		case 3: return THREE;
		case 4: return FOUR;
		case 5: return FIVE;
		case 6: return SIX;
		case 7: return SEVEN;
		case 8: return EIGHT;
		case 9: return NINE;
	}
}

int main(void){
	int n;
	int x;
	while(cin>>n,n!=-1){
		bitset<7> now;
		while(n--){
			cin>>x;
			bitset<7> sig(decode(x));
			sig^=now;
			cout<<sig<<endl;
			now=decode(x);
		}
	}
}