#include <iostream>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
int main(){
	int digit[10][7] = {{0,1,1,1,1,1,1}, {0,0,0,0,1,1,0}, {1,0,1,1,0,1,1}, {1,0,0,1,1,1,1},
	{1,1,0,0,1,1,0}, {1,1,0,1,1,0,1}, {1,1,1,1,1,0,1}, {0,1,0,0,1,1,1}, {1,1,1,1,1,1,1}, {1,1,0,1,1,1,1}};
	int n, a;
	while(cin >> n) {
		if(n==-1) break;
		int x[7] = {0,0,0,0,0,0,0};
		rep(i,n) {
			cin >> a;
			rep(j,7) {
				int y = digit[a][j]^x[j];
				cout << y;
			}
			cout << endl;
			rep(j,7) x[j] = digit[a][j];
		}
	}
}