#include <iostream>
using namespace std;

int main(void){
	int n = 0,in;
	int array[][8] ={
		{0,1,1,1,1,1,1}, // 0
		{0,0,0,0,1,1,0},
		{1,0,1,1,0,1,1},
		{1,0,0,1,1,1,1}, // 3
		{1,1,0,0,1,1,0}, // 4
		{1,1,0,1,1,0,1}, // 5
		{1,1,1,1,1,0,1}, // 6
		{0,1,0,0,1,1,1}, // 7
		{1,1,1,1,1,1,1}, // 8
		{1,1,0,1,1,1,1}  // 9
	};
	int box[] = {0,0,0,0,0,0,0};
	while(cin>>n,n!=-1){

		int box[] = {0,0,0,0,0,0,0};
		while(n--){
			cin>>in;
			for(int i = 0 ; i < 7 ; i ++){
				cout<<(box[i] != array[in][i]?1:0);
				box[i] = array[in][i];
			}
			cout<<endl;
		}
	}
}