#include <iostream>
using namespace std;

int main() {
    int j,n,a,b;
    int d[11][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},{0,0,0,0,0,0,0}};
    while(cin >> n && n!=-1) {
		for (a=10;n>0;n--) { cin >> b;
		for (j=0;j<7;j++) cout << (d[a][j]+d[b][j]) % 2;
		a=b; 
		cout << endl;}
	}
	return 0;
}