#include<iostream>
using namespace std;

int main(){
	string segments[11] = {"0111111", "0000110", "1011011", "1001111", "1100110", "1101101", "1111101", "0100111", "1111111", "1101111", "0000000"};
	int num;
	int nowSegment;
	int input;

	while(cin >> num, num != -1){
		nowSegment = 10;
		for(int i=0; i < num; i++){
			cin >> input;
			for(int j=0; j < 7; j++){
				if(segments[nowSegment][j] == segments[input][j]) cout << 0;
				else cout << 1;
			}
			cout << endl;
			nowSegment = input;
		}
	}
}