#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
	char seg[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, m;
	char dis[7];

	while (1){
		scanf("%d", &n);
		if (n == -1){
			break;
		}

		for (int i = 0; i < 7; i++){
			dis[i] = 0;
		}

		for (int i = 0; i < n; i++){
			scanf("%d", &m);
			for (int j = 0; j < 7; j++){
				if (dis[j] != seg[m][j]){
					dis[j] = seg[m][j];
					printf("1");
				}
				else {
					printf("0");
				}
			}
			printf("\n");
		}
	}

	return (0);
}