#include <bits/stdc++.h>
using namespace std;
int main(){
	bool data[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;
	while(cin>>n&&n!=-1){
		bool state[7];
		memset(state,false,sizeof(state));
		while(n--){
			int input;
			cin>>input;
			for(int i=0;i<7;i++){
				cout<<(state[i]^data[input][i]);
				state[i]=data[input][i];
			}
			cout<<endl;
		}
	}
}