#include <iostream>
#include <iomanip> 
using namespace std;

int main(){
	int seg[] = {0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111};
	int n;
	while(cin >> n,n != -1){
		int prev = 0;
		for(int i = 0;i < n;i++){
			int t,next;
			cin >> t;
			next = seg[t] ^ prev;
			for(int j = 6;j >= 0;j--){
				cout << (next >> j & 1);
			}
			cout << endl;
			prev = seg[t];
		}
	}
	return 0;
}