// 2011/01/09 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int seg[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(true){
		int n;
		cin >> n;
		if(n==-1)
			break;

		int pst = 10;
		int now;
		for(int i=0; i<n; i++){
			cin >> now;
			for(int j=0; j<7; j++)
				cout << (seg[pst][j]+seg[now][j])%2;
			cout << endl;
			pst = now;
		}
	}

	return 0;
}