#include <bits/stdc++.h>
using namespace std;

int main() {
	vector<int> seg = {0b0111111,0b0000110,0b1011011,0b1001111,0b1100110,0b1101101,0b1111101,0b0100111,0b1111111,0b1101111,0b0000000};
	while(1){
		int n;
		cin >> n;
		if(n==-1) break;
		int d0=10, d1;
		for(int i=0; i<n; i++){
			cin >> d1;
			cout << bitset<7>(seg[d0]^seg[d1]) << endl;
			d0=d1;
		}
	}

}

